admin管理员组文章数量:1419202
similar to: Does Mixpanel Analytics for Android work when offline?
On the Javascript API, does the event and user tracking are keep safe when the visitor is offline?
I ask because our application is sometimes used on mobile and we need to track this offline events still.
similar to: Does Mixpanel Analytics for Android work when offline?
On the Javascript API, does the event and user tracking are keep safe when the visitor is offline?
I ask because our application is sometimes used on mobile and we need to track this offline events still.
Share Improve this question edited May 23, 2017 at 11:44 CommunityBot 11 silver badge asked Jan 14, 2013 at 22:56 Fabiano SorianiFabiano Soriani 8,5889 gold badges45 silver badges59 bronze badges4 Answers
Reset to default 4No, it does not. If you look at the unpressed JS, events are not queued up and there are no retries on failure. The callback is passed a 0 in the event of failure, though, so you can use this to implement your own retry if you want.
On html5 devices and browsers Localytics writes all event data to Persistent Storage and uploads them w/ the correct timestamp when connection is available.
Although Mixpanel doesn't work like this out of the box you could use the same approach and check their callback value to determine when to delete the events. The timestamps won't be correct but you will get all of your data.
Feel free to check our source (linked in the doc below) to see how we do it: http://www.localytics./docs/html5-integration/
-- Henry
It doesn't out of the box, as raylu pointed in the original source code. But if you also look at the source code and the documentation for the REST API, you can pass in time
as an argument to track
, which allows you to make sure that the timestamps are correct (as an improvement on henry's answer).
If you look for MixpanelLib.prototype.track
in the JS, you can see that it doesn't change time, and if you look at the REST API documentation, they specifically say:
time is the time at which the event occured, it must be a unix timestamp, requests will be rejected that are 5 days older than codesent time - this is done for security reasons as your token is public generally. Format is seconds since 1970, GMT time zone. If you'd like to import data, you can through a special API for any event.
Mixpanel does not support tracking while offline, but there's no reason why you can't implement it yourself. At the end of the day, Mixpanel JS library is a JavaScript wrapper over the HTTP API.
You can write your own JavaScript library that uses the Mixpanel HTTP API. You can learn about how to do this for an Ionic/Cordova app here - although the blog post is targetted at tracking for offline Cordova apps, it demonstrates the concept of offline-resilient tracking for Mixpanel using JavaScript.
本文标签: Does Mixpanel Analytics for Javascript work when offlineStack Overflow
版权声明:本文标题:Does Mixpanel Analytics for Javascript work when offline? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745295186a2652032.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论