Snowplow JavaScript Tracker 1.0.0 released

27 March 2014  •  Fred Blundun

We are pleased to announce the release of the Snowplow JavaScript Tracker version 1.0.0.

This release adds new options for user fingerprinting and makes some minor changes to the Tracker API. In addition, we have moved to a module-based project structure and added automated testing.

This post will cover the following topics:

  1. New feature: user fingerprint options
  2. Changes to the Snowplow API
  3. Move to modules
  4. Automated testing
  5. Removed deprecated functionality
  6. Other structural improvements
  7. Upgrading
  8. Getting help

The Snowplow JavaScript Tracker uses a “user fingerprint” to identify users based on various features of their browser.

This version adds two new functions to control user fingerprinting: enableUserFingerprinting and setUserFingerprintSeed.

function enableUserFingerprinting(enable)

function setUserFingerprintSeed(seed)

User fingerprinting is turned on by default, but can be turned off like this:

_snaq.push(['enableUserFingerprinting', false]);

If you want to choose the seed used to generate the user fingerprint, use setUserFingerprintSeed like this:

_snaq.push(['setUserFingerprintSeed', 746392851]);

If you do not set a custom hash seed, the default seed will be used instead.

The move to modules has allowed us to tighten our public API, making our helper functions private.

In addition, the global SnowPlow object has been renamed to Snowplow. This will only affect users who have implemented the synchronous tracker.

We have organised our code into modules using Browserify. Browserify recursively analyzes the dependencies of the Tracker and combines all the required modules into a single bundle. This allowed us to replace much of our code with external npm modules and a minimal lodash library.

We have started to use Intern for non-functional testing of our asynchronous queue and payload builder modules. We have also added Travis CI to the project. Travis runs the Intern tests every time the Javascript Tracker repository is altered, preventing errors from going unnoticed. We plan to expand the test suite to include functional tests in coming versions.

Five deprecated functions have been removed:

  • attachUserId is removed because there is no longer any need to enable or disable specific user IDs
  • setSiteId should be replaced with setAppId
  • getVisitorId should be replaced with getDomainUserId
  • getVisitorInfo should be replaced with getDomainUserInfo
  • trackEvent should be replaced with getStructEvent, the new name for this

Finally, trackImpression has been deprecated in preparation for the addition of an all-new trackAdImpression in a coming version.

We have also:

  • Added meta-data to our package.json including a description and keywords #83
  • Moved the banner into our Gruntfile and dynamically templated in information from our package.json #82
  • Removed the legacy Piwik plugin framework #56
  • Named our Grunt tasks #86
  • Added a “Built with Grunt” badge to the README #102
  • Relocated some helper functions for consistency #91

UPDATED After an important post-release bug fix, the updated minified tracker is available here:

http(s)://d1fc8wv8zag5ca.cloudfront.net/1.0.1/sp.js

If you use the path:

http(s)://d1fc8wv8zag5ca.cloudfront.net/1/sp.js

then you will automatically get new semantic-minor versions and patches as they are released.

Check out the v1.0.0 release page on GitHub for the full list of changes made in this version.

As always, if you run into any issues or don’t understand any of the above changes, please raise an issue or get in touch with us via the usual channels.