We’re pleased to announce a small release of our JavaScript Trackers which improves your options when using Anonymous Tracking. This release includes updates to @snowplow/browser-tracker
and the tag based sp.js
from @snowplow/javascript-tracker
.
Updates to clearUserData()
clearUserData
now clears all session and user identifiers, including those stored in the memory of the tracker, rather than only clearing the cookies. This ensures if any subsequent tracking happens following deleting the Snowplow cookies, that no identifiers will remain in memory and be used for future events.
If you’d like to preserve the session, so that future events on the same page are part of the same session, you can specify the preserveSession
flag which will give you the same behaviour as previous releases. There is also a preserveUser
flag for preserving the domain_userid and custom user_id properties.
Breaking change: There is a small breaking change in this release as the clearUserData
function was missing the configuration object on the API which is now present. This means the API is now:
clearUserData(configuration?: ClearUserDataConfiguration, trackers?: Array<string>)
Updates to enableAnonymousTracking()
You can now toggle stateStorageStrategy when enabling anonymous tracking, not only when disabling it.
This means if you want to disable storage again, you can do so when toggling anonymous tracking on.
enableAnonymousTracking({
stateStorageStrategy: 'none'
})
Upgrading
Click here for more information on what the Version 3 release of the Snowplow JavaScript Trackers contained and how to upgrade. A migration guide from v2 to v3 can here found in our documentation .
Links to where you can find this on third party CDNs for testing can be found here.