Custom HTML with zaraz.track endles loop

For Workers & Pages, what is the name of the domain?

No worker or pages

What is the issue or error you’re encountering

The script in the custom html fires in a endles loop

What steps have you taken to resolve the issue?

This happend only when the zaraz.track is in the script, if the script doesn’t contain the zaraz.track it runs only time.
I found this post ans seems is like this one

Here the screenshots of the trigger and the html code

I’m trying something similar on a wordpress site and I can’t get to add the script irrespective of the triggers or the script code containing zaraz.track()

any pointers?

To track searchs in a WP site, the firing trigger must check for the URL containing ?s= or URL Query parameters starting with ?s=.

In the image I’ve posted I use to check URL containing the ?s=.

This trigger can be used as the firing trigger in a Custom HTML. For testing purposes you can set this code in the Custom HTML

<script>
     console.log("Trigger Fired");
</script>

This must log in the chrome developer tools console the mesage “Trigger Fired” each time the url contains ?s=

This works, almost for me, but when in the code there is the zaraz.track to set the zaraz event, the script is loaded in an endless loop

I don’t know why but now it repeat only 3 times.
A 1st time with the code in the Custon HTML tool, as spected:

(function(w,d){{const d = document.createElement('div');d.innerHTML = ``;document.body.appendChild(d);};{
    console.log('event_url:' + window.location.href.split('?')[0]);
    // zaraz.track('Busqueda',{event_url: window.location.href.split('?')[0],search_term:"cantera" });
}})(window,document)

The 2nd time when another event fires/Custom HTML inject their code:

(function(w, d) {
    {
        const d = document.createElement('div');
        d.innerHTML = ``;
        document.body.appendChild(d);
    }
    ;{
        zaraz.track('30 segundos', {
            time: "30 seg", 
            event_url: "https://intersindicalrm.org/spublicos/?s=cantera"
        });
    }
    ;{
        const d = document.createElement('div');
        d.innerHTML = ``;
        document.body.appendChild(d);
    }
    ;{
        console.log('event_url:' + window.location.href.split('?')[0]);
        // zaraz.track('Busqueda',{event_url: window.location.href.split('?')[0],search_term:"cantera" });
    }
    ;{
        (function(w, d) {
            zaraz.__zarazMCListeners = {
                "google-analytics_v4_OCaw": ["visibilityChange"]
            };
        }
        )(window, document);
    }
}
)(window, document)

And a 3rt time when a visibilityChange is fired

(function(w, d) {
    {
        const d = document.createElement('div');
        d.innerHTML = ``;
        document.body.appendChild(d);
    }
    ;{
        console.log('event_url:' + window.location.href.split('?')[0]);
        // zaraz.track('Busqueda',{event_url: window.location.href.split('?')[0],search_term:"cantera" });
    }
    ;{
        (function(w, d) {
            zaraz.__zarazMCListeners = {
                "google-analytics_v4_OCaw": ["visibilityChange"]
            };
        }
        )(window, document);
    }
}
)(window, document)

If I put the “All Tracks” as a Blocking trigger, then only 2 times is fired.
But the “All Tracks” event in the GA4 tool is disabled.