简体   繁体   English

如何使用Meteor中的okgrow:analytics包将用户ID发送到Google Analytics?

[英]How do I send a user id to Google Analytics using the okgrow:analytics package in Meteor?

I'm trying to send a userId to Google Analytics in Meteor using the okgrow:analytics package. 我正在尝试使用okgrow:analytics包将用户okgrow:analytics发送到Meteor中的Google Analytics。 Using the Google Analytics Debugger Chrome extension, I have determined that the userId is not being sent. 使用Google Analytics Debugger Chrome扩展程序,我确定未发送userId。 (I have also set up a dedicated userId view in Google Analytics following the steps here ). (我还按照此处的步骤在Google Analytics中设置了专用的userId视图)。

In the okgrow:analytics documentation it is stated: "...this package will automatically track when a user logs in and logs out. Logging in will call identify on the user and associate their Meteor.userId to their previous anonymous activities." okgrow:analytics文档中,它表示:“...此程序包将自动跟踪用户登录和注销的时间。登录将调用用户身份并将其Meteor.userId与之前的匿名活动相关联。”

Looking through their code, it seems that they didn't set the integrations options to include Google Analytics. 查看他们的代码,似乎他们没有设置integrations选项以包含Google Analytics。 After seeing this I tried calling analytics.indentify(Meteor.userId(), {integrations: {"Google Analytics": true}}) in the callback of Meteor.loginWithPassword , but still no userId was sent. 看到这个后,我尝试在Meteor.loginWithPassword的回调中调用analytics.indentify(Meteor.userId(), {integrations: {"Google Analytics": true}}) ,但仍然没有发送userId。

我在Github上打开了一个问题,解决方案是将settings.json文件中的Google分析设置更改为:

'Google Analytics' : {'trackingId': <ga-id>, 'sendUserId':true}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM