如何通过Google Analytics中的产品展示次数事件发送自定义维度?

时间:2017-07-04 10:01:40

标签: google-analytics google-tag-manager enhanced-ecommerce

我目前正在尝试使用产品展示次数事件发送自定义尺寸值。其他一切似乎都有效,但我无法报告自定义尺寸值。

我已为星级评分和评论计数设置了维度8和维度9。我已将这些值传递给对象,并且已成功发送。

dataLayer.push({
    'event': 'productDetailImpressions',
    'ecommerce': {
        'detail': {
            'actionField': {
                'list': 'PDP'
            },
            'products': [{
                'name': name,
                'id': id,
                'price': price,
                'brand': brand,
                'category': category,
                'variant': variant,
                'dimension8': reviewCount,
                'dimension9': starRating
            }]
        }
    }
});

我已根据GA中的产品范围设置了这些自定义尺寸。

我可以在浏览器中查看标签及其使用插件发送的信息,这些值看起来是正确的。

但是,我仍然无法在Google Analytics中报告这些值。

我有什么问题吗?

谢谢。

1 个答案:

答案 0 :(得分:1)

范围界定需要两件事:

在Google Analytics(分析)管理界面中配置范围
见下面的截图: enter image description here

发送具有适当匹配的自定义维度
Data is sent to Google Analytics with "hits"。命中是:

  • 页面跟踪匹配次数
  • 事件跟踪命中
  • 电子商务跟踪触及社交
  • 互动点击

Now this doesn't mean that you should structure your dataLayer so that the custom dimensions are on the same level ase the object (eg user, product) you're trying to associate them with。相反,您应该遵循标准方法来设置尺寸:

在Google Analytics(分析)中,它是:

// Set the dimension
ga('set', 'cd1', 'Level 1');
// Send custom dimension along with a hit (eg pageview)
ga('send', 'pageview');

现在有了Google跟踪代码管理器,GTM不会将任何匹配发送到Google Analytics(分析),它只是准备数据和自动使用GA的工具。举个例子:

dataLayer.push({
    'event': 'productDetailImpressions',
    'dimension8': reviewCount,
    'dimension9': starRating,
    'ecommerce': {
        'detail': {
            'actionField': {
                'list': 'PDP'
            },
            'products': [{
                'name': name,
                'id': id,
                'price': price,
                'brand': brand,
                'category': category,
                'variant': variant,
            }]
        }
    }
});

然后创建一些dataLayer变量以读取自定义维度值:

enter image description here

最后,将这些维度分配给您的GA标签:

enter image description here

注意:您可能会使其与您拥有的dataLayer一起使用,只需替换dataLayer变量即可指向正确的位置,但是我认为这是错误的做法,因为它导致人们认为必须嵌套尺寸在作用域对象中才能正常工作(这是不正确的),这会使事情更难以调试。