Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Offline Caching #358

Closed
normanrz opened this issue Mar 25, 2014 · 10 comments
Closed

Offline Caching #358

normanrz opened this issue Mar 25, 2014 · 10 comments

Comments

@normanrz
Copy link

I looking for an analytics solution for a Cordova/Phonegap app. I cannot assume the user to be connected to the internet at all times, so I need some sort of caching when offline. Does this lib support that?

@JoeStanton
Copy link

👍

1 similar comment
@berlinhudson
Copy link

👍

@eroltoker
Copy link

This seems to work in the iOS library, so I'm assuming there is some way of sending an event at a later time with an appropriate timestamp.

In order to simplify things, we should simply have an API ourselves that allows us to specify the timestamp of the event and handle offline caching at the application level (i'd rather not have the library touch localStorage or any other resources that the application is using)

@lancejpollard
Copy link
Contributor

This is definitely something we're interested in doing, it's not supported atm though. We'll keep this open and come back to it soon.

@eroltoker
Copy link

@lancejpollard- ideally using localstorage to persist events across reloads would be optional or there would be some way to manage how much resources we can reserve in localstorage for this purpose.

In the meantime, we've found that simply adding the 'time' parameter to the object representing a tracked event allows us to populate events within mixpanel retroactively :)

@flinn
Copy link

flinn commented Jan 12, 2015

👍

@hereismass
Copy link

Hello, I am looking for the same thing for my webkit desktop app, which runs even if the user has no connection.

In the meantime I did a simple js wrapper over the HTTP API that does that : https://github.com/hereismass/osjs

@QuentinFchx
Copy link

Also the Quick Start snippet does not handle cases where a web app is started without an internet connection.
We want to integrate with the network information Cordova plugin

if(window.navigator.connection && window.Connection && window.navigator.connection.type == window.Connection.NONE){
    document.addEventListener('online', function(){
        // Include Analytics.js script tag
    })
}

I understand that we don't especially want to add an overhead for everybody.
Do you think it would make sense to propose an alternative for Cordova apps with this additional logic, and update the documentation accordingly ?
I can do it myself, but if we could standardized it and make it available in the official doc for everybody...

@preexo
Copy link

preexo commented Jul 5, 2016

+1 for this, would really make sense to make it part of the the package

@f2prateek
Copy link
Contributor

Integrations are responsible for queueing events themselves - there's no way for the analytics library to be able to know that Mixpanel's SDK delivered the event while Amplitude's didn't (note that Amplitude's js library does it's own queueing as well for this reason).

As for Segment itself, we've added retries when sending data to Segment segment-integrations/analytics.js-integration-segmentio#23. This is currently behind a flag and must be opted in, but we'll probably make it the default soon.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants