Alex writes: this is the first blog post – and code release – by Snowplow “springtern” Fred Blundun. Stay tuned for another blog post soon introducing Fred!
In this release we have introduced some new tracking options and compressed our tracker for better load times. We have also updated our build process to use Grunt.
This blog post will cover the following changes:
- New feature: gzipping
- New feature: set user ID from a cookie
- New feature: set user ID from a querystring
- New feature: pass a referrer through an iframe
- New feature: respecting Do Not Track
- New build process
- Other structural improvements
- Getting help
This new function allows you to set the visitor’s business user ID to the value of a first-party cookie. Its signature is:
For example, this code:
will look for a cookie whose name is “_sp_id.4209”. If one is found, the user ID will be set to the value of that cookie.
We have added support for setting the visitor’s business user ID from a field in the querystring of either the current page’s URL or the referring page’s URL. The signatures for the new functions are:
For example, to set the user’s ID to the value of the “id” field in the local querystring, use:
And to set it to the value of the “id” field in the referrer querystring, use:
You can now pass the referrer back to Snowplow from inside an iframe. To do this, set
referrer=x in the querystring of the iframe’s URL, where ‘x’ is the required referrer. This also works if you set
referer=x (with one ‘r’).
Many thanks to community member Josh Spivey for this idea and some suggested code!
Most browsers offer a Do Not Track feature, allowing users to request not to be tracked by websites. You can now respect that preference with:
Use this function like so:
We have replaced our custom
snowpak.sh Bash script with a standardised Grunt file. This let us use Grunt plugins to automate the build process, from file concatentation and YUI Compression through to uploading to S3 and CloudFront invalidation.
It should also help us move to a more modular project structure and add a test suite in the next release.
We have also:
- Moved cookie-related functionality into a new file (#77)
- Moved requestStringBuilder into a new file (#55)
- Moved functions to detect browser attributes into a new file (#37)
- Removed getLegacyCookieName (#50)
- Removed the legacy Piwik debug code (#65)
The upgraded minified tracker is available here:
If you are currently using the path:
then you will get the new version automatically.
Check out the v0.14.0 release page on GitHub for the full list of changes made in this version.