【问题标题】:Custom Google Analytics dimension not showing up on dashboard自定义 Google Analytics 维度未显示在仪表板上
【发布时间】:2021-08-26 22:05:31
【问题描述】:

我正在使用以下代码在 Angular 中设置我的自定义谷歌分析维度:

var date_enrolled = '11/11/2021 11:59 AM';
gtag('config', 'UA-XXXXXXX', { 'enrollment_date':  date_enrolled});

我在我的 localhost:4200 上运行它。当我转到页面 localhost:4200/emp 时,会调用此代码。现在在谷歌分析(来自浏览器)中,我关注了这个网址:

https://support.google.com/analytics/answer/2709829?hl=en&ref_topic=2709827#zippy=%2Cin-this-article

并创建了一个自定义维度。但是,当我将自定义维度添加到其中一个见解时,它不会显示任何记录。你能告诉我我在这里可能缺少什么吗?

【问题讨论】:

    标签: angular google-analytics google-analytics-4


    【解决方案1】:

    要将自定义维度发送到 Google Analytics(分析),请更新您的媒体资源的配置以设置维度的 custom_map 参数,然后使用自定义参数发送自定义维度的值:

    // Configures custom dimension<Index> to use the custom parameter
    // 'dimension_name' for 'GA_MEASUREMENT_ID', where <Index> is a number
    // representing the index of the custom dimension.
    gtag('config', 'GA_MEASUREMENT_ID', {
      'custom_map': {'dimension<Index>': 'dimension_name'}
    });
    
    // Sends the custom dimension to Google Analytics.
    gtag('event', 'any_event_name', {'dimension_name': dimension_value});
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多