Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SDK: analytics?.getAnonymousId #1199

Copy link
Copy link
@philibea

Description

@philibea
Issue body actions

Add the possibility to getAnonymousId. It's use full to set to others provider like Growthbook ( AB testing solution ) attributes

  setAnonymousId: (id: string) => {
      if (opts.debug) {
        console.log("[JITSU DEBUG] Setting anonymous id to " + id);
      }
      //Workaround for analytics.js bug. Underlying setAnonymousId doesn't  set the id immediately,
      //so we got to it manually here. See https://github.com/jitsucom/jitsu/issues/1060
      storage.setItem("__anon_id", id);
      const userState = analytics.user();
      if (userState) {
        userState.anonymousId = id;
      }
      (analytics as any).setAnonymousId(id);
    },

maybe we can have a better type for user function instead of any ?

   user  (): any;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.