dataLayer信息未显示在GTM调试器中

时间:2018-10-19 17:35:22

标签: google-tag-manager

我正在尝试在开发人员的帮助下实施Google跟踪代码管理器dataLayer。开发人员说一切都按应有的方式实现,但是我看不到GTM调试器中的dataLayer信息。我想设置“增强型电子商务” GA,并且已经将文档发送过来,但是由于某些原因它仍然无法正常工作。

这是我检查页面源代码后可以看到的代码。在产品页面上:

<!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-M8VNL5N');</script>
    <!-- End Google Tag Manager -->
    <script>

            dataLayer.push({
          'event': ‘ProductView'
          'ecommerce': {
            'detail': {
              'actionField': {},
              'products': [{
                'name': ‘Product Name’,
                'id': '58141',
                'price': '545.00',
                'brand': ‘Product Brand’,
                'category': ‘Product Category’,
               }]
             }
           }
        });
    </script>

你们能看到不应该那样的东西吗?我现在对JS不太满意,也找不到问题的根源。

非常感谢您的帮助!

最好!

1 个答案:

答案 0 :(得分:1)

尝试一下,出现奇怪的引号和逗号。

dataLayer.push({
      'event': 'ProductView', //comman was missing here and weird quote
      'ecommerce': {
        'detail': {
          'actionField': {},
          'products': [{
            'name': 'Product Name', //weird quote here
            'id': '58141',
            'price': '545.00',
            'brand': 'Product Brand', //weird quote
            'category': 'Product Category', //weird quote
           }]
         }
       }
    });

结果:

enter image description here

相关问题