来自控制器的Mixpanel.track [英] Mixpanel.track from the controller

查看:138
本文介绍了来自控制器的Mixpanel.track的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序提交了一个简单的表单(电子邮件)。我将MixPanel的跟踪分析集成到应用程序中,并希望每次与此表单进行交互时进行跟踪 - 特别是当用户成功/不成功提交表单时,以及他们的电子邮件是什么。

I have an application that has a simple form submission (an email). I have MixPanel's tracking analytics integrated into the app, and want to track every time an interaction with this form happens--specifically, when a user successfully/unsuccessfully submits the form, and what their email is.

在做了一些研究之后,似乎最简单的方法是在控制器级别跟踪(我正在运行验证,并做出是否合法提交的总体决策)。这需要从控制器运行JS函数。这可能吗?有没有更好的方法呢?

After doing some research, it seems simplest method is to track at the controller level (where I am running validations, and making the overall decision whether or not the submission is legitimate). This would require running a JS function from the controller. Is this possible? Is there a better method of doing this?

推荐答案

让我们整合这个宝石分析

然后按照上面链接中的说明操作,但这里是摘要:

Then just follow the instruction in above link, but here is the summary:


  1. 向控制器添加分析

  2. 中设置mixpanel令牌config / analytical.yml

production:
  mixpanel:
    key: your_mixpanel_project_token
development:
  # Also define here if you want to test in development
test:


  • 在控制器中跟踪您的活动:

  • Track your event in controller:

    # data_key_1, data_value_1, data_key_2 and data_value_2 are the data
    #  which were attached to mixpanel event, they are example, specify yours
    analytical.event 'Your event', data_key_1: data_value_1, data_key_2: data_value_2
    


  • 您可以将更多内容与GA,KISSMetrics或任何您想要的内容集成在一起,跟踪代码适用于通用,这也适用于javascript代码,有关更多详细信息,请参阅其文档

    You may integrate more with GA, KISSMetrics, or whatever you want, the tracking code works in generic, this also works with javascript code, for more detail, please refer its documentation.

    这篇关于来自控制器的Mixpanel.track的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆