can't track my e-commerce transaction with angular 7

My index.html head


(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,‘script’,‘https://www.google-analytics.com/analytics.js’,'ga’);
ga(‘create’, gaCode , ‘auto’);


app.component.ts constructor


this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
ga(‘set’, ‘page’, event.urlAfterRedirects);
ga(‘send’, ‘pageview’);

      ga('require', 'ecommerce', 'ecommerce.js');
      // Transaction Data
      ga('ecommerce:addTransaction', {
        id: '1234',
        affiliation: 'Example Page',
        revenue: '100',
        shipping: '0',
        tax: '0',
        currency: 'USD'
      });
      ga('ecommerce:send');
    }
  });

(You might get an answer here, but because this forum is focused on npm, you might want to ask your question somewhere that targets experts with your package. I have moved your topic to #community:javascript)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.