【问题标题】:Track download including custom dimensions跟踪下载,包括自定义尺寸
【发布时间】:2018-09-27 09:40:13
【问题描述】:

我正在尝试将 Google Analytics 的解决方案调整为 Matomo。 在 Google Analytics 中,我有:

  • 3 个自定义维度(维度 1、维度 2、维度 3 用于存储有关用户帐户/已保存首选项的信息)
  • 下载发生时触发的 1 个自定义事件

我的代码是这样的:

function track_download(data) {
    var GA = window.ga || function() {
        // ga is not defined, log function arguments
        if (window.console) {
            console.log([].slice.call(arguments));
        }
    };

    // Custom dimensions
    GA('set', 'dimension1', data.some_profile_information1);
    GA('set', 'dimension2', data.some_profile_information2);
    GA('set', 'dimension3', data.some_profile_information3);

    // Track event
    GA('send', {
        'hitType': 'event', // Required.
        'eventCategory': 'page', // Required.
        'eventAction': 'custom_download', // Required.
        'eventLabel': data.the_title_of_downloaded_section,
        'eventValue': 1
    });
};

然后在 Google Analytics(分析)中,我可以得到自定义报告,例如:

  • 活跃成员最常用的个人资料类型
  • 最活跃的下载部分
  • 下载次数(总/每部分)

是否可以在 Matomo 中发送带有自定义事件的 custom dimensions 以获得相同的报告/行为?

更新:

更新:

这样尝试过,自定义维度的报告中没有数据。

var MA = window._paq || function() {
  // Matomo is not defined, log function arguments
  if (window.console) {
    console.log([].slice.call(arguments));
  }
};

MA.push([
  'trackEvent',
  'page',               // category
  'my_custom_download', // action
  data.item_title,      // name
  1,                    // value
  {                     // custom dimensions
    dimension1: data.dim1,
    dimension2: data.dim2,
    dimension3: data.dim3
  }
]);

这是来自docs_paq.push(['trackEvent', category, action, name, value, {dimension1: 'DimensionValue'}]);

【问题讨论】:

    标签: javascript google-analytics matomo


    【解决方案1】:

    您提到的解决方案应该可以工作,但可能会出现延迟(例如大约一小时):

    var MA = window._paq || function() {
      // Matomo is not defined, log function arguments
      if (window.console) {
        console.log([].slice.call(arguments));
      }
    };
    
    MA.push([
      'trackEvent',
      'page',               // category
      'my_custom_download', // action
      data.item_title,      // name
      1,                    // value
      {                     // custom dimensions
        dimension1: data.dim1,
        dimension2: data.dim2,
        dimension3: data.dim3
      }
    ]);
    

    【讨论】:

      猜你喜欢
      • 2019-07-24
      • 2013-04-28
      • 1970-01-01
      • 2020-11-11
      • 2014-05-02
      • 2020-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多