SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How is the anonymousId generated in Segment?

Question

How is the anonymousId generated in Segment?

 

Product

Twilio Segment

 

Environment

Segment Console

 

Answer

How the anonymousId is generated depends on the Segment libraries you are using:
  • Browser or mobile libraries: The Segment SDK automatically generates and sets a UUID as the anonymousId during the user's first visit to your site. This anonymousId is saved in the user's cookie and localStorage, and will stick with that user until the cache is cleared or a reset call is triggered.
  • Server libraries: You must generate the anonymousId manually. It can be any pseudo-unique identifier; for example, you might use a sessionId from a backend server.
You can use the anonymousId to link events performed by the user as they navigate around your website. When you track the anonymousId, you can attribute activities over multiple days to the same user by collecting all activities with that ID. If a user chooses to register for your site or log in to your app, you can identify them and still include their anonymousId in the event payload along with their new userId.
 
 

Additional Information 

Review the Segment product documentation for Best Practices for Identifying Users.

 

Have more questions? Submit a request
Powered by Zendesk