Hello! I think I’ve installed my ecommerce tracking incorrectly and my pages are being counted twice.
In my <head>
<script>
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(['enableHeartBeatTimer']);
(function() {
var u="//example.com/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
On my product page, just before the closing </body>
:
<script>
_paq.push(['setEcommerceView',
"<?=$Product->getSku();?>",
"<?=$Product->getTitle();?>",
"<?=$Product->getCategory();?>",
<?=$Product->getPriceIncl();?>
]);
_paq.push(['trackPageView']);
</script>
I’m calling _paq.push(['trackPageView']);
twice which I think is incorrect but the docs mention “You must also call trackPageView when tracking a product view”.
What is a good way to make sure I’m only calling trackPageView once?