Skip to content

How to respect queued function calls to snippet global when initializing via npm #1235

@bgiori

Description

@bgiori

I am a developer for a script which needs to integrate with segment to track events.

Our script, installed in the page head, regularly loads before segment, even when segment is installed in the main app bundle via npm.

Our script relies on queueing the ready function to the snippet window.analytics array in order to know when the segment analytics sdk is ready to provide user identity (anonymous id, user id, traits) and track events. If the segment sdk is installed via npm (no snippet/function queue) then functions queued to the global are not called by default.

I understand we can't always rely on the global being set and named analytics, but it'd be useful to be able to initialize the npm installed instance with an option to read a function queue from a global.

Happy to answer any questions if something is not clear.

TL;DR I'd like to request the ability to configure a global function queue to read from when initializing the SDK installed via npm.

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