localStorage and first-party cookies.
The rest of this blog post will cover the following topics:
- More powerful callbacks
- Disabling localStorage and cookies
- Non-integer offsets
- Getting help
Version 2.1.1 added support for custom callbacks to be executed when sp.js loads:
This release extends that support by calling the callback function as a method on an internal
trackerDictionary object. This sets the value of
this in the callback to the
trackerDictionary, allowing you to call methods which return results on individual tracker instances.
An example which extracts all the available fields:
getDomainUserInfo() returns an array containing 6 elements:
- A string set to
'1'if this is the user’s first session and
- The domain user ID
- The timestamp at which the cookie was created
- The number of times the user has visited the site
- The timestamp for the current visit
- The timestamp of the last visit
This change is backward-compatible unless you were relying on your callback function being executed in the global context (meaning that
this is set to
We would like to thank Snowplow community member Rob Murphy (@murphybob) for his help developing this feature!
localStorage to store this queue so the events are recoverable even after the user leaves the site.
You can now disable this use of
localStorage by setting a flag in the argmap used to create a new tracker instance. You can also disable the use of first-party cookies:
Snowplow page ping events include the maximum and minimum scroll distances since the last pa
ge ping. We found that it is possible for the scroll values reported by the browser to not be whole numbers, causing the event to fail enrichment (which requires these fields to be integers). We have fixed this bug by rounding the relevant values to the nearest integer.
Check out the documentation for more help and examples.