Introducing Version 3.0 of Snowplow’s JavaScript Trackers




We are delighted to announce a huge new milestone for our suite of Snowplow JavaScript Trackers.
Today we are introducing Version 3.0 of our JavaScript trackers which includes an updated sp.js tag based JavaScript tracker and @snowplow/node-tracker as well as our long awaited @snowplow/browser-tracker, available on npm.
This means we now have a number of options when it comes to capturing behavioral data from the web. You can continue to use our tag based solution, by either embedding the tag in your website or from a tool such as Google Tag Manager. Alternatively, you can now install the tracker directly from npm and embed the tracker directly into your web app (npm install @snowplow/browser-tracker
). This is a great option for those building modern web apps in technologies such as React, Angular and Vue.
Whats new?
There is quite a lot going on in this release but the main features are:
- Available on NPM as @snowplow/browser-tracker. Install with npm install @snowplow/browser-tracker.
- Now with configurable (and extendable) plugin architecture. These plugins are also published on NPM (e.g. @snowplow/browser-plugin-ad-tracking and @snowplow/browser-plugin-consent).
- New API, you should now pass objects rather than parameter lists (e.g. window.snowplow(‘trackPageView’, { title: ‘My Website’, contexts: [ … ] });)
- Introducing a new smaller asset. We’re publishing as traditional sp.js (69.64 KB – 22.14 KB gzipped) and new sp.lite.js (37.85 KB – 13.08 KB gzipped). sp.lite.js has no Plugins included but does include Page View, Self Describing and Structured Events as well as Activity Tracking and Anonymous Tracking.
- sp.js and sp.lite.js are available on jsDelivr and unpkg.
- Build your own sp.js by following these instructions.
- Completely rewritten in TypeScript, shipped with full type support.
Getting started
Over the coming days and weeks we will be publishing a number of tutorials and guides to getting started with these trackers however, if you want to get started now then we’ve published a migration guide from v2 to v3 and documentation for the new @snowplow/browser-tracker
.
Migration Guide
If you’re using the current tag based solution and you’d like to upgrade, you can take a look at the migration guide
Installing from npm
If you’d like to try the new @snowplow/browser-tracker
, then thats as easy as:
npm install @snowplow/browser-tracker
import { newTracker, trackPageView } from "@snowplow/browser-tracker";
newTracker('sp1', '{{collector_url}}', {
appId: 'my-app-id',
plugins: [ ],
})
trackPageView();
Using Plugins
If you’d like to go one step further and try one of the new plugins, then you just install the plugin, tell the tracker about it and start using it:
npm install @snowplow/browser-plugin-form-tracking
import { newTracker, trackPageView } from "@snowplow/browser-tracker";
import { FormTrackingPlugin, enableFormTracking } from "@snowplow/browser-plugin-form-tracking";
newTracker('sp1', '{{collector_url}}', {
appId: 'my-app-id',
plugins: [ FormTrackingPlugin() ],
});
enableFormTracking();
trackPageView();
Documentation
You’ll find lots more documentation over on our documentation site.