0

Will segment share the same anonymous IDs between two subdomains?

Hello,

We are trying to understand if Segment share the same anonymous IDs between subdomains.

We have a following setup:

If a user lands at example.com, and then (in the same or some future session) navigates to dashboard.example.com, will we see one or two anonymous IDs in Segment?

3replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • From my experience (and I've only been using Segment for about two weeks now) it does. The ID appears to be passed via local storage, which is shared across a domain and its subdomains 

    Reply Upvote
  • Mark Hansen thanks! One more question, when you say "local storage" what do you mean? JavaScript localStorage or cookies? Because localStorage is not shared between subdomains.

    Reply Upvote
  • Hey Slobodan!

    That's a great question.

    Mark is really close! Segment's website library (analytics.js) automatically creates an anonymous id for a user who lands on your website and is not logged in. This id is accessible and stored in your browser's cookies; that way, the same anonymous id is associated with a user throughout the entire browsing session. Since the id is accessible through the cookies on the browser, it will persist through subdomains.

    Here is a great link to our docs explaining more about how we use anonymous ids: 
    https://segment.com/docs/spec/identify/#anonymous-id

    Thanks for writing in!

    Reply Upvote