Ecommerce tracking double trackPageView

Hello! I think I’ve installed my ecommerce tracking incorrectly and my pages are being counted twice.

In my <head>

  var _paq = window._paq = window._paq || [];
  (function() {
    var u="//";
    _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);

On my product page, just before the closing </body>:


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?

I think this just means that if you call setEcommerceView, trackPageView must also have been called. So no need to call it twice.
Did you try to just call once (omitting the second call of trackPageView)?

Thanks for your reply! I just tested with removing the second trackPageView but unfortunately I’m now not seeing the ecommerce data.

So, I probably have to call the setEcommerceView before the first trackPageView?