Skip to content

Queue calls while awaiting load when using the NPM package #428

@tsheaff

Description

@tsheaff

I'm loading from NPM rather than through the snippet.

I may be misunderatanding how AnalyticsBrowser.load() works, and I see reference in the docs to the library enqueuing calls before the script loads, but according to the example in the README, the analytics instance is optional until await AnalyticsBrowser.load({ ... }) is completed. This means any analytics?.track(...), analytics?.identify(...) etc. will be no-ops while awaiting. This seems quite bad since there will now be race conditions between our initial events like page views, versus the time for the AnalyticsBrowser.load to complete.

Am I misunderstanding things? How can I get all of my calls to analytics to work, even those that run immediately after calling await AnalyticsBrowser.load but before that response has come back? Do I have to wrap the lib and implement enqueing myself?

cc @chrisradek @pooyaj @danieljackins

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions