Skip to content

Switch from in-memory to persistence after loading AnalyticsBrowser #1299

@theosamaperspective

Description

@theosamaperspective

We have a use case where we want to start tracking with AnalyticsBrowser using in-memory storage only—this lets us handle tracking before the user has consented to persistent storage. Once the user gives consent (e.g., via a cookie banner), we’d like to switch to using localStorage and cookies for persistence.

The issue we’re facing is that the disableClientPersistence flag and the storage providers seem to be fixed after calling load(), and from what I understand, reloading the library isn’t recommended. This makes it tricky to upgrade the storage behavior mid-session based on consent.

Is there a way to support this kind of opt-in persistence flow with AnalyticsBrowser? Or would it be possible to add support for dynamically switching the storage strategy after initialization?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions