Read on for more information:
- The session ID
- The page view ID
- Context-generating functions
- New Grunt task
- Breaking change to trackPageView
- Breaking change to session cookie timeouts
- Documentation and help
1. The session ID
If cookies are disabled, the session ID will be stored in memory rather than in a cookie. It will be regenerated after 30 minutes.
2. The page view ID
To make it easier to aggregate all events from a particular page load into single rows, we have added the new optional
web_page context. This context has a single “id” field, containing a unique version 4 UUID for the page view. The UUID is generated on page load and the context is attached to all events fired on the page.
To enable this context, add “webPage” to the “contexts” field of the tracker construction argmap:
3. Context-generating functions
When you add contexts to a page view, those contexts automatically get added to all subsequent page pings. But what if you want the contexts to update depending on new information?
It is now possible to pass a context-generating function to
trackPageView. This function should return a (possibly empty) array of custom contexts. For example:
Once the above code is executed, the initial page view and all page pings will have two contexts attached. The first, a static context which contains the datetime from the call to trackPageView, will be the same for all events. The second, a dynamic context, will be re-computed for every event, and will have a different datetime in each case.
4. New Grunt task
To speed up development, we have added a Grunt task which builds the tracker skipping the steps of building the custom lodash.js library and minification. You can invoke it from the command line in the root directory like this:
5. Breaking change to trackPageView
The previous version of the tracker deprecated the “performanceTiming” argument to the
trackPageView function. This release removes it completely:
6. Breaking change to session cookie timeouts
setSessionCookieTimeout method is no longer effective. This is because the cookie is set as soon as the tracker is created, before the method gets a chance to be called. Instead, you can add a
sessionCookieTimeout field to the tracker’s construction argmap:
The upgraded minified tracker is available here:
Make sure to update your tracking code to reflect the two breaking changes highlighted above.
8. Documentation and help
The v2.5.0 release page on GitHub has the full list of changes made in this version.