Does Mixpanel Analytics for Javascript work when offline? - Stack Overflow

similar to: Does Mixpanel Analytics for Android work when offline?On the Javascript API, does the event

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 badges
Add a ment  | 

4 Answers 4

Reset to default 4

No, 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745295186a4621096.html

相关推荐

  • Does Mixpanel Analytics for Javascript work when offline? - Stack Overflow

    similar to: Does Mixpanel Analytics for Android work when offline?On the Javascript API, does the event

    4小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信