简体   繁体   English

在Angular.js中使用mixpanel

[英]Using mixpanel with angular.js

How can I use mixpanel in SPA? 如何在SPA中使用混合面板? I want to track some events created by user. 我想跟踪用户创建的一些事件。 When user opens page first time randomly generated ID is given to him. 当用户第一次打开页面时,将随机生成ID。 After signing in this action is executed. 登录后执行此操作。

mixpanel.alias(data.id);
mixpanel.track('Sign In', {
    'Email': response.data.email
});

user.setCurrent(data);

In user.setCurrent function I do this: 在user.setCurrent函数中,我这样做:

mixpanel.identify(data.id);

But in my mixpanel account random ID still given to user? 但是在我的混合面板帐户中,仍然给用户提供了随机ID吗? What should I do to prevent this? 我应该怎么做才能防止这种情况?

Using mixpanel.identify doesn't actually change the ID Mixpanel uses : 使用mixpanel.identify 实际上并不会更改Mixpanel使用的ID

On the signup confirmation page, you call mixpanel.alias("john@hotmail.com"). 在注册确认页面上,您调用mixpanel.alias(“ john@hotmail.com”)。 This doesn't actually change his ID - he is still being identified using the random ID we originally assigned him. 这实际上并不会更改他的ID-我们仍会使用我们最初为他分配的随机ID来识别他。

What you can do is to add the ID you use in your database to the Mixpanel Person, just like you do with the email at the moment. 您可以做的就是将您在数据库中使用的ID添加到Mixpanel Person中,就像当前处理电子邮件一样。 Then configure the Mixpanel UI to show that column in your reports. 然后配置Mixpanel UI,以在报告中显示该列。

mixpanel.track('Sign In', {
    'Email': response.data.email,
    'UserId': response.data.id
});

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

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