如何使用@redux-beacon/google-analytics 让多个跟踪器工作?
How to get multiple trackers to work using @redux-beacon/google-analytics?
我在我的项目中使用 redux-beacon 和 google-analytics 来跟踪两个 Google 分析帐户中的电子商务事件。由于并非所有数据都出现在报告中,我正在尝试使用 Google Analytics Debugger Chrome Extension 调试出错的地方。似乎所有调用都会抛出一个 'Set called on unknown field: "customTrackerId".' 以前有人遇到过这个吗?
import {
trackEcommProduct,
trackEcommAction,
trackPageView,
trackEvent
} from '@redux-beacon/google-analytics';
export const CLIENT_TAG = 'client';
const getLocation = () => window.location.href;
const getPage = () => getLocation().split('#')[1];
export const clientPageView = trackPageView((action, prevState, nextState) => ({
location: getLocation(),
page: getPage(),
title: action.title
}), CLIENT_TAG);
通过 chrome 扩展程序将事件粘贴到控制台上:
VM20555 analytics_debug.js:15 Executing Google Analytics commands.
VM20555 analytics_debug.js:15 Running command: ga("client.set", "page", "/product/4")
VM20554 app.ba606e9ace53a50ecd21.js:93766 CC client.
VM20555 analytics_debug.js:15 Executing Google Analytics commands.
VM20555 analytics_debug.js:15 Running command: ga("client.send", {hitType: "pageview", customTrackerId: "client", page: "/product/4", title: undefined, location: "http://localhost:3333/#/product/4"})
VM20555 analytics_debug.js:15 Set called on unknown field: "customTrackerId".
VM20555 analytics_debug.js:15
Sent beacon:
v=1&_v=j76d&a=291005201&t=pageview&_s=1&dl=http%3A%2F%2Flocalhost%3A3333%2F%23%2Fproduct%2F4&dp=%2Fproduct%2F4&ul=es-es&de=UTF-8&dt=Here's%20a%20title%20from%20setting%3A%20frontoffice_title&sd=24-bit&sr=1440x900&vp=830x766&je=0&_u=SCCACEIJB~&jid=&gjid=&cid=709854029.1557150989&tid=UA-62066942-1&_gid=86805739.1559994923&z=310945797
感谢您指出这一点。这看起来是我们这边的一个问题。 trackPageView
事件助手向事件添加 customTrackerId
属性 以允许我们使用给定的跟踪器 ID(或一组跟踪器 ID)进行点击。这个 属性 不需要存在于 redux-beacon 之外,所以我只是从任何传出事件中解析它。我发布了 google-analytics 目标的新版本:
npm install @redux-beacon/google-analytics@1.2.2
试一试,如果它能解决您的问题,请告诉我!
我在我的项目中使用 redux-beacon 和 google-analytics 来跟踪两个 Google 分析帐户中的电子商务事件。由于并非所有数据都出现在报告中,我正在尝试使用 Google Analytics Debugger Chrome Extension 调试出错的地方。似乎所有调用都会抛出一个 'Set called on unknown field: "customTrackerId".' 以前有人遇到过这个吗?
import {
trackEcommProduct,
trackEcommAction,
trackPageView,
trackEvent
} from '@redux-beacon/google-analytics';
export const CLIENT_TAG = 'client';
const getLocation = () => window.location.href;
const getPage = () => getLocation().split('#')[1];
export const clientPageView = trackPageView((action, prevState, nextState) => ({
location: getLocation(),
page: getPage(),
title: action.title
}), CLIENT_TAG);
通过 chrome 扩展程序将事件粘贴到控制台上:
VM20555 analytics_debug.js:15 Executing Google Analytics commands.
VM20555 analytics_debug.js:15 Running command: ga("client.set", "page", "/product/4")
VM20554 app.ba606e9ace53a50ecd21.js:93766 CC client.
VM20555 analytics_debug.js:15 Executing Google Analytics commands.
VM20555 analytics_debug.js:15 Running command: ga("client.send", {hitType: "pageview", customTrackerId: "client", page: "/product/4", title: undefined, location: "http://localhost:3333/#/product/4"})
VM20555 analytics_debug.js:15 Set called on unknown field: "customTrackerId".
VM20555 analytics_debug.js:15
Sent beacon:
v=1&_v=j76d&a=291005201&t=pageview&_s=1&dl=http%3A%2F%2Flocalhost%3A3333%2F%23%2Fproduct%2F4&dp=%2Fproduct%2F4&ul=es-es&de=UTF-8&dt=Here's%20a%20title%20from%20setting%3A%20frontoffice_title&sd=24-bit&sr=1440x900&vp=830x766&je=0&_u=SCCACEIJB~&jid=&gjid=&cid=709854029.1557150989&tid=UA-62066942-1&_gid=86805739.1559994923&z=310945797
感谢您指出这一点。这看起来是我们这边的一个问题。 trackPageView
事件助手向事件添加 customTrackerId
属性 以允许我们使用给定的跟踪器 ID(或一组跟踪器 ID)进行点击。这个 属性 不需要存在于 redux-beacon 之外,所以我只是从任何传出事件中解析它。我发布了 google-analytics 目标的新版本:
npm install @redux-beacon/google-analytics@1.2.2
试一试,如果它能解决您的问题,请告诉我!