anonymous_id. When a user signs up or logs in, call identify() to link the browser to your own user ID. Their earlier anonymous activity then joins their profile.
Step 1: Choose a user ID
Use a stable ID from your own app, such as your database user ID. Do not use an email address as the ID: emails change, and an email can be a trait instead.Step 2: Call identify after login
identify() sends an identify event with the user_id and the traits. The SDK stores the user ID in a first-party browser-session cookie and adds it to later events. Events from before identify() have the same anonymous_id, so they link to the user.
With the HTML snippet, use window.untitledAnalytics.identify(...).
Step 3: Update traits
Traits are scalar values: string (up to 1024 characters), number, boolean ornull. A later call updates only the keys it sends:
company_domain hint. Common personal email providers are excluded.
You can also add or change traits on the user’s profile page under Customer properties.
Step 4: Reset on logout
reset() clears the user ID, the anonymous ID and the session from every storage layer. The next event starts a new anonymous visitor. Stored history is not deleted.
Identify from your backend
When the user ID is known only on the server, send anidentify server event with the Secret key. Include the browser’s anonymous_id (from analytics.getAnonymousId()) to link that browser to the user.
One player on the website and in the game
A player has one anonymous ID in each browser and one in each game install. Reports join them into one user in two ways:- The same user ID: the website and the game both call
identify()with the same user ID. - A link from the game: the game opens your website with the Godot SDK’s
link_url(). This works for players who never sign in.
- The link works for 10 minutes. An older link joins nothing.
- If links from one game install open in more than 3 browsers, the link was shared, and none of them join.
- If one browser opens links from two or more game installs, it joins none of them.
- If the joined IDs have two different user IDs, no user is given to the anonymous activity.
The 10-minute limit uses the time in the link, so it stops a shared link in a normal browser. Someone who builds the request by hand and knows a game’s anonymous ID can still join their own browser to that player in your reports. The game ID is only in links that the player opens. This affects analytics data only.