Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setOffline() to enable custom offline logic #654

Open
Mercy811 opened this issue Jan 29, 2024 · 4 comments
Open

Add setOffline() to enable custom offline logic #654

Mercy811 opened this issue Jan 29, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@Mercy811
Copy link
Contributor

Summary

This issue is to collect customer requests on adding setOffline().

Amplitude Browser SDK supports offline mode out of the box by #644.

Leave a comment under this issue with the use causes when and why you need this feature. We will prioritize it and fit into our roadmap.

@Mercy811 Mercy811 added the enhancement New feature or request label Jan 29, 2024
@Mercy811 Mercy811 mentioned this issue Jan 29, 2024
1 task
@Multiply
Copy link

We're using the offline property to dynamically pause sending events. This allow us to capture events in the unsent queue, until the customer answers our consent popup (which can be delayed), and then if they give consent, we can unpause the queue.

It's a bit unfortunate the feature is called offline, instead of using something more generic, like "pause", as it could be used by multiple plugins if it wasn't only associated with offline.

Renaming it to something like "paused" might be better, and then allow different plugins to set their own locks, and if any lock is set, events won't be sent until all locks are lifted.

@Mercy811
Copy link
Contributor Author

Hi @Multiply, I think for this scenario particularly you can amplitude.track() first. Then if user accepts your consent, call amplitude.init() to initialize the SDK. In this way, events are tracked and are in storage without actually being sent to Amplitude until user consent and init the SDK.

@Multiply
Copy link

@Mercy811 consent can be changed during runtime, and we'd still have to pause events in that scenario.

@Mercy811
Copy link
Contributor Author

@Multiply I see. I will keep you updated once we have the feature in our roadmap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants