Mixpanel跟踪事件间歇性失败

编程入门 行业动态 更新时间:2024-10-24 00:24:09
本文介绍了Mixpanel跟踪事件间歇性失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的页面发送了一些不同的mixpanel事件.在提交表单时会发送其中的几个表单(两个不同的表单,每个表单都有自己的模式).在所有事件中,表单提交事件之一间歇性失败,我不知道为什么.两种表单提交都具有jQuery,如:

I have a few different mixpanel events being sent from my page. A couple of them are sent upon form submissions (two different forms, each in its own modal). Of all the events, one of the form submission events fails intermittently and I can't figure out why. Both form submissions have jQuery like:

$(document).on 'submit', '#myForm', (e) -> mixpanel.track('my form submitted')

一种形式是可靠的,另一种形式是不可靠的(大约3/4的时间失败).我将不可靠的更改为:

One form is reliable, the other is not (it fails about 3/4 of the time). I changed the unreliable one to:

$(document).on 'submit', '#myForm', (e) -> window.mixpanel.track('my form submitted')

,它似乎在大多数时间都有效,但仍然不总是如此.我是在想象差异,还是将mixpanel.track更改为window.mixpanel.track可能有所改变.哦,我在这里想念什么?

and it seems to work most of the time, but still not always. Am I imagining the difference, or could changing mixpanel.track to window.mixpanel.track have changed something. And what oh what am I missing here?

推荐答案

我认为这是由Mixpanels异步行为引起的.当您调用Submit时,track()指令以非阻塞方式开始执行,即使在对Mixpanel API的track()调用仍在进行时,也允许提交表单.如果发生这种情况,您的表单将在track()调用完成之前提交.

I think this is caused by Mixpanels asynchronous behaviour. When you call submit, the track() instruction starts executing in a non blocking way, allowing to submit the form even when the track() call to the Mixpanel API is still ongoing. If this happens, your form will be submitted before the track() call is completed.

单击链接时会发生同样的事情,并得到解释在这篇文章中.这就是Mixpanel提供 track_links()和 track_forms()方法.这些解决了以下问题,可能对您有帮助.

The same thing is happening when clicking on links and is explained in this post. It's the reason Mixpanel offers the track_links() and track_forms() methods. These solve the problem as follows and may be helpful in your case.

此功能将最多等待300毫秒,以使Mixpanel服务器响应,如果此时尚未响应,它将转到链接,而不确保已跟踪您的事件.要配置此超时,请参阅下面的mixpanel.set_config文档.

This function will wait up to 300 ms for the mixpanel servers to respond, if they have not responded by that time it will head to the link without ensuring that your event has been tracked. To configure this timeout please see the mixpanel.set_config docs below.

更多推荐

Mixpanel跟踪事件间歇性失败

本文发布于:2023-11-16 15:57:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605723.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:间歇性   事件   Mixpanel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!