【问题标题】:How to change the default value of "non-interaction" events in Google Analytics如何更改 Google Analytics 中“非交互”事件的默认值
【发布时间】:2022-08-22 22:26:42
【问题描述】:

我在我的项目中使用了 Google 的模型查看器,不幸的是,当某些事件应该是 non-interaction: true 时,它会将它们视为 non-interaction: false。在我的例子中,这些是在模型加载、检测到支持 AR 的用户以及检测到支持 QR 的用户时触发的事件。

如何手动将这些事件的非交互值设置为 true?我尝试过类似的解决方案但无济于事:

export type AnalyticsEvent = {
  type: string;
  category: string;
  action: string;
  label: string;
  value: number;
  nonInteraction: boolean;
};
export const USER_WITH_AR_SUPPORT_TEMPLATE: AnalyticsEvent = {
  type: \'event\',
  category: AR_CATEGORY,
  action: \'UserWithArSupport\',
  label: \'\',
  value: \'\',
  nonInteraction: true,
};
\"kind\": \"javascript-module\",
\"path\": \"src/globals/ArEvents.ts\",
\"declarations\": [
  {
    \"kind\": \"variable\",
    \"name\": \"userWithArSupportTemplate\",
    \"type\": {
      \"text\": \"AnalyticsEvent\"
    },
    \"default\": \"{\\n  type: \'event\',\\n  category: ARCategory,\\n  action: \'UserWithArSupport\',\\n  label: \'\',\\n ,\\n nonInteraction: true}\"
  },

我也尝试过 [这里][1] 的解决方案,以及几个类似的解决方案。我是否为非交互使用了错误的变量名或索引?

编辑:根据要求添加了更多代码



  [1]: https://stackoverflow.com/questions/7922544/google-analytics-non-interaction-trackevent-not-firing
  • 你的javascript是什么样的?我看到了一些 JSON 数据,但没有看到您如何使用他们的 Javascript SDK 的全部价值。另外,你用的是GA4吗?还是通用分析?
  • @d-_-b 你需要从我的 JS 中看到什么?我目前正在使用通用分析
  • 如果您共享用于记录事件的 javascript,将更容易告诉您需要更改的内容以及您可能如何错误地调用它。

标签: javascript json typescript google-analytics model-viewer


【解决方案1】:

如果您使用的是 gtag.js,则需要将 non_interaction: true 添加为 documented here

 gtag('event', '<event-name>', {
   'event_label': '',
   'event_category': 'AR_CATEGORY',
   'event_action': 'UserWithArSupport',
   'non_interaction': true
 }); 

【讨论】:

    猜你喜欢
    • 2021-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多