Hi all,
First-time poster, short time lurker!
I am integrating matomo for a client and have already done google analytics successfully.
However, they want custom dimensions set when a trigger happens on the site. So I set the custom dimensions as per below when the page is loaded
var _paq = [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['setCustomDimension', customDimensionId = 15, customDimensionValue = 'A VALUE']);
_paq.push(['setCustomDimension', customDimensionId = 1, customDimensionValue = 'not set']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//OURPWIKI";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
Then as it’s a single page app (no page refresh or hash changes) I trigger this code to push a new custom dimension to be set when a trigger happens (trigger successfully fires this code)
<script>
_paq.push(['setCustomDimension', customDimensionId = 1, customDimensionValue = '{{DataLayer - Property ID}}']);
</script>
Yet, this information isn’t coming through the system, what am I doing wrong?
Any help is VERY appreciated.
Thanks,
Michael