User Identification
The library manages user sessions and identity tracking automatically via cookies and the Segmentify API.
Session & User IDs
Section titled “Session & User IDs”Every event is enriched with two IDs managed as cookies:
| Cookie | Lifetime | Purpose |
|---|---|---|
_sgf_session_id | 24 hours | Identifies a single browsing session |
_sgf_user_id | 1 year | Persists across sessions for returning users |
These are created automatically on the first event. If either is missing, the library fetches new IDs from the Segmentify API.
Linking to Known Users
Section titled “Linking to Known Users”You can associate tracked behavior with a known user via:
userin config — set at initialization (see Configuration)email/externalIdin event payloads — passed on any event callRegister,LogIn,Identifyevents — dedicated user operations (see Events)
Platform Detection
Section titled “Platform Detection”The library detects the user’s device automatically using the Bowser library:
| Platform | Value |
|---|---|
| Desktop | 'PC' |
| Mobile | 'mobile' |
| Tablet | 'tablet' |
This is included in every event payload as part of the enriched ExtendedPayload, along with OS name, OS version, and browser.