对于类型为“"timing"”的命中,缺少必填字段“"timingCategory"”和“"timingVar"”- Google Analytics [redux-beacon]
Missing required field '"timingCategory"' and '"timingVar"' for hit of type '"timing"' - Google Analytics [redux-beacon]
我正在使用 redux-beacon
发送 Google 分析点击。它在 Event Tracking
上运行良好,但在 User Timings
上运行失败。正如我在 doc for User Timing 上看到的那样,它需要 timingCategory
、timingVar
和 timingValue
,但是 redux-beacon
发送时没有 timing
前缀。
以下代码在 trackEvent
的 redux-beacon 日志中生成有效事件,但在 trackTiming
.
中生成失败
import {trackTiming, trackEvent} from '@redux-beacon/google-analytics';
const userTiming = trackTiming(action => {
return {
category: 'Test category',
var: 'load',
value: 3549,
label: action.type
};
});
const event = trackEvent(action => {
return {
category: 'Test category',
action: action.type,
label: 'Test label',
value: 45
};
});
export const eventsMap = {
USER_TIMING_ACTION: userTiming,
EVENT_ACTION: event
};
它给我以下错误:
Running command: ga("send", {hitType: "timing", customTrackerId: undefined, category: "Test category", var: "load", value: 3549, label: "USER_TIMING_ACTION"})
Set called on unknown field: "customTrackerId".
Set called on unknown field: "category".
Set called on unknown field: "var".
Set called on unknown field: "value".
Set called on unknown field: "label".
Missing required field '"timingCategory"' for hit of type '"timing"'
Missing required field '"timingVar"' for hit of type '"timing"'
这是 redux-beacon
在控制台中为 userTracking
打印的内容:
hitType: "timing", customTrackerId: undefined, category: "Test category", var: "load", value: 3549, var: "load"}
我做错了什么,还是 redux-beacon
跟踪时间的错误?
我使用的版本:
"@redux-beacon/google-analytics": "1.0.2",
"@redux-beacon/logger": "1.0.0",
"redux-beacon": "2.0.3"
这是事件助手的错误。现在修好了。请升级到最新版本的GA目标:
npm install --save @redux-beacon/google-analytics@1.0.3
作为补充提示。如果事件助手出现问题,您可以轻松解决问题如果您需要快速修复。
例如,在您的情况下您可以这样写:
const userTiming = action => ({
hitType: 'timing',
timingCategory: 'Test category',
timingVar: 'load',
timingLabel: action.type,
});
export const eventsMap = {
USER_TIMING_ACTION: userTiming,
};
以下是编写事件定义的文档:
https://rangle.gitbook.io/redux-beacon/index-1/event-definition
感谢您抽出时间来写信、提出问题并强调您遇到的问题。有这么多不同的目标和事件助手,像这样的错误报告非常有用。
我正在使用 redux-beacon
发送 Google 分析点击。它在 Event Tracking
上运行良好,但在 User Timings
上运行失败。正如我在 doc for User Timing 上看到的那样,它需要 timingCategory
、timingVar
和 timingValue
,但是 redux-beacon
发送时没有 timing
前缀。
以下代码在 trackEvent
的 redux-beacon 日志中生成有效事件,但在 trackTiming
.
import {trackTiming, trackEvent} from '@redux-beacon/google-analytics';
const userTiming = trackTiming(action => {
return {
category: 'Test category',
var: 'load',
value: 3549,
label: action.type
};
});
const event = trackEvent(action => {
return {
category: 'Test category',
action: action.type,
label: 'Test label',
value: 45
};
});
export const eventsMap = {
USER_TIMING_ACTION: userTiming,
EVENT_ACTION: event
};
它给我以下错误:
Running command: ga("send", {hitType: "timing", customTrackerId: undefined, category: "Test category", var: "load", value: 3549, label: "USER_TIMING_ACTION"})
Set called on unknown field: "customTrackerId".
Set called on unknown field: "category".
Set called on unknown field: "var".
Set called on unknown field: "value".
Set called on unknown field: "label".
Missing required field '"timingCategory"' for hit of type '"timing"'
Missing required field '"timingVar"' for hit of type '"timing"'
这是 redux-beacon
在控制台中为 userTracking
打印的内容:
hitType: "timing", customTrackerId: undefined, category: "Test category", var: "load", value: 3549, var: "load"}
我做错了什么,还是 redux-beacon
跟踪时间的错误?
我使用的版本:
"@redux-beacon/google-analytics": "1.0.2",
"@redux-beacon/logger": "1.0.0",
"redux-beacon": "2.0.3"
这是事件助手的错误。现在修好了。请升级到最新版本的GA目标:
npm install --save @redux-beacon/google-analytics@1.0.3
作为补充提示。如果事件助手出现问题,您可以轻松解决问题如果您需要快速修复。
例如,在您的情况下您可以这样写:
const userTiming = action => ({
hitType: 'timing',
timingCategory: 'Test category',
timingVar: 'load',
timingLabel: action.type,
});
export const eventsMap = {
USER_TIMING_ACTION: userTiming,
};
以下是编写事件定义的文档: https://rangle.gitbook.io/redux-beacon/index-1/event-definition
感谢您抽出时间来写信、提出问题并强调您遇到的问题。有这么多不同的目标和事件助手,像这样的错误报告非常有用。