简体   繁体   中英

No data in GA and GTM using dataLayer

I'm using Google Tag Manager and dataLayer to pull information from an eCommerce site to Google Analytics, but for the past few days the 'Add to Cart' chart has been empty, even though the test site is working fine, pulling data as it should, and I've used the same code copied across.

I can see the trigger firing in preview mode, and in live events it appears as an add to cart event but no data is showing in shopping behavior which I cannot work out.

This is the code I'm using for dataLayer:

        dataLayer.push({
        'event': 'addToCart',
        'ecommerce': {
            'currencyCode': curr,
            'add': {                       
              'products': [{               
                'id': pg,
                'name': garmentName,
                'price': garm,
                'brand': 'MyStore',
        //        'category': 'Apparel',
        //        'position': 0,
                'quantity': 1
               }]
            }
          }
        });

curr , pg , garmentName , and garm are all JavaScript variables pulled from the PHP the site runs on.

A screenshot of the tag I'm using is available here

There was nothing wrong with my code or tag, I had closed the function which contains the dataLayer push too early

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM