Skip to main content

Anonymous visitor ID

getLocalUserId

Across Wyng platforms an anonymous visitor ID is be assigned to each visitor, that is used to identify returning visitors. The ID is scoped by the fully qualified domain of the containing web page, and stored in browser localStorage on the visitor's device, as value uid.

note

Different browsers have different expiration times for data stored in browser localStorage. For example Safari will store the data in browser localStorage for a maximum of 7 days of inactivity on the domain, while Chrome will not expire the data in browser localStorage unless the user clears their data.

Example

Get the anonymous visitor ID for the current visitor. If no ID has been set, a random value will be generated and stored in browser localStorage.

window.wyng['_WYNG_ID_'].getLocalUserId()