温馨提示:本文翻译自stackoverflow.com,查看原文请点击:其他 - Google Analytics is not receiving all data from Data Layer via GTM
google-analytics google-tag-manager google-datalayer enhanced-ecommerce

其他 - Google Analytics(分析)未通过GTM从数据层接收所有数据

发布于 2020-03-31 23:37:56

目前,我正在使用增强型电子商务。从Google Analytics(分析)网站获取数据,但并非一切正常。
购物车跟踪(付款和运输)正在运行,我可以在Google Analytics(分析)上看到它,但是跟踪产品点击次数,测量产品视图,跟踪购物车中的添加量以及跟踪从购物车中移除商品的功能均无法正常运行。

当我加载页面的某些部分时,使用以下代码不会在数据层中填充任何数据:

    //Tracking Product Clicks
        dataLayer.push({
           "event":"EEproductClick",
           "ecommerce": {
             "currencyCode": curr,
             "click": {
               "actionField": {"list":"category" },
               "products": [{
                 "id": pdc,
                 "name": GarmName,
                 "price": prix,
                 "brand": "MyBrand",
                 "category": ""
              }]
            }
          }
        });
//End


//Measuring Views of Product Details
        dataLayer.push({
           "ecommerce": {
             "currencyCode":curr,
             "detail": {
               "actionField": {"list":""},     //optional list property
               "products": [{
                 "id":pdc,
                 "name":GarmName,
                 "price":prix,
//               "brand":"Boss",
//               "category":"Men/Clothing/T-Shirts",
//               "variant":"black"
              }]
            }
          }
        });
//End

//Tracking adds to cart
        dataLayer.push({
           "event":"EEaddToCart",
           "ecommerce": {
             "currencyCode": curr,
             "add": {
               "products": [{
                 "id": pdc,
                 "name": GarmName,
                 "price": prix,
                 "brand": "MyBrand",
//               "category":"Men/Clothing/T-Shirts",
//               "variant":"black", //optional, if there is a variant of the product
                 "quantity":1
              }]
            }
          }
        }); 
//End

//Tracking removes from cart
        dataLayer.push({
           "event":"EEremoveFromCart",
           "ecommerce": {
             "currencyCode": curr,
             "remove": {
               "products": [{
                 "id": pdc,
                 "name": GarmName,
                 "price": prix,
                 "brand": "MyBrand",
//               "category":"Men/Clothing/T-Shirts",
//               "variant":"black", //optional, if there is a variant of the product
//               "quantity":1
              }]
            }
          }
        }); 
//End

我目前使用下面的代码填充数据层,但是使用谷歌代码管理工具,没有数据被发送到谷歌Analytics(分析)除了购买过程。

    //Measuring Views of Product Details
        dataLayer.push({
          event: 'ProductView',
          ecommerce: {
            detail: {
              actionField: {
                list: 'Search Results'
              },
              products: [{
                id: pdc,
                name: GarmName,
//              category: 'guides/google-tag-manager/enhanced-ecommerce',
//              variant: 'Text',
//              brand: 'SIMO AHAVA',
//              dimension3: 'Ecommerce',
//              metric5: 12,
//              metric6: 1002
              }]
            }
          }
        }); 
//END

//Measuring Product Clicks
        dataLayer.push({
        event: 'EE_ProductView',
        'ecommerce': {
        'detail': {
            'actionField': {},
                'products': [{
                    'name': GarmName,
                    'price': prix,
                    'id': pdc
                    }]
                }
            }
        })
//End

//Measuring Additions or Removals from a Shopping Cart
        dataLayer.push({
          'event': 'addToCart',
          'ecommerce': {
            'currencyCode': curr,
            'add': {
              'products': [{
                'name': GarmName,
                'id': pdc,
                'price': prix,
                'quantity': 1
               }]
            }
          }
        });
//End

// Measure the removal of a product from a shopping cart.
        dataLayer.push({
          'event': 'removeFromCart',
          'ecommerce': {
            'remove': {
              'products': [{
                  'name': GarmName,
                  'id': pdc,
                  'price': prix,
                  'quantity': 1
              }]
            }
          }
        });
//End

一组代码可以工作而另一组不能工作,我在做错什么呢?以及如何让GTM将接收到的数据推送到Google Analytics(分析)?

非常感谢

编辑:我已经删除了我的代码和GTM / GA标签,并全部重写了它们,现在看来在一定程度上起作用了。尽管如此,仍然会遇到相同的问题,因此我们将对此进行进一步调查

查看更多

提问者
Aaron
被浏览
64
Aaron 2020-02-04 23:39

我删除了所有代码和标签,并从头开始。将某些标签从“事件”更改为“页面视图”,反之亦然,似乎已经解决了我遇到的问题。
数据现在被推送到DataLayer,并由GA提取。

感谢大家的帮助