Quantcast
Channel: Support & Bugs - Matomo forums
Viewing all articles
Browse latest Browse all 5706

Ecommerce events not being tracked

$
0
0

@mob wrote:

I’ve been trying dozens of different things over the past few weeks, but no matter what I try, 50-75% of ecommerce events are not being reported.

My app is an AngularJS app. Here’s what I’m doing.

index.html:

    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      // _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//piwik.myapp.org/";
        _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);
      })();
    </script>
    <!-- End Piwik Code -->

Order confirmation page:

The following code is called in a network request callback:

var sku = "4";
var payAmount = 30;

// addEcommerceItem(productSKU, productName, productCategory, price, quantity)
_paq.push(['addEcommerceItem', sku, "Subscription", subscription.frequency, payAmount, 1]);

// trackEcommerceOrder(orderId, grandTotal, subTotal, tax, shipping, discount)
_paq.push(['trackEcommerceOrder', subscription.id, payAmount, payAmount]);
_paq.push(['trackPageView']);

The annoying thing is, when I test this myself, both in development and production, it works wonderfully and is reported in my dashboard. However, it doesn’t work for external users for some reason.

I’ve tried different variations of where to place _paq.push(['trackPageView']); hoping that might help, but it hasn’t changed anything. I’m not exactly sure what the timing of trackPageView should even be.

Any ideas?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5706

Trending Articles