The method requireCookieConsent is registered more than once in "_paq" variable

Hey there,
I’m a bit puzzled about those 3 Errors Messages I get on my Websites:

The method requireCookieConsent is registered more than once in "_paq" variable. Only the last call has an effect. Please have a look at the multiple Matomo trackers documentation: https://developer.matomo.org/guides/tracking-javascript-guide#multiple-piwik-trackers matomo.js:12:288
The method setTrackerUrl is registered more than once in "_paq" variable. Only the last call has an effect. Please have a look at the multiple Matomo trackers documentation: https://developer.matomo.org/guides/tracking-javascript-guide#multiple-piwik-trackers matomo.js:12:288
The method setSiteId is registered more than once in "_paq" variable. Only the last call has an effect. Please have a look at the multiple Matomo trackers documentation: https://developer.matomo.org/guides/tracking-javascript-guide#multiple-piwik-trackers

As far as I can see in my Code … those Methods aren’t set twice - but only once?

<script type="application/javascript" data-type="application/javascript" data-name="matomo">
	  var _paq = window._paq = window._paq || [];
	  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
	  _paq.push(['requireCookieConsent']);
	  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
	  _paq.push(['trackPageView']);
	  _paq.push(['enableLinkTracking']);
	  _paq.push(['enableHeartBeatTimer']);
	  (function() {
	    var u="https://my.dom.tld/";
	    _paq.push(['setTrackerUrl', u+'matomo.php']);
	    _paq.push(['setSiteId', '1']);
	    _paq.push(['addTracker', piwikUrl = u+'matomo.php', 1382]);                    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
	    g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
	  })();
</script>
<noscript>
	<p><img src="https://my.dom.tld/matomo.php?idsite=1&rec=1" style="border:0;" alt="" /></p>
	<p><img src="https://my.dom.tld/matomo.php?idsite=1382&rec=1" style="border:0;" alt="" /></p>
</noscript>

Any ideas on that?

Thank you, bye from Austria
Andreas

Hi,

Is there any reason for this?

Maybe you are using a consent manager or another JS script that executes this script block a second time?

Oh my god … that could have triggered me myself … :frowning:
The problem has existed since an update of the Klaro! Cookie Consent Manager … with this there was a change regarding the tag recognition … since then it seems to be running the Matomo things twice again as soon as cookies are activated … I have to see how I can get around this …since I’m using ‘_paq.push([‘requireCookieConsent’]);’ I only use the CookieManager in this context to give / withdraw the consent - and not to completely deactivate / activate the script …

Thank you as always! :slight_smile:
Best regards from Tyrol
Andy

1 Like