Introducing Version 3.0 of the Snowplow JavaScript Trackers (Browser and Node.js)

We are extremely pleased 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 @snoplow/browser-tracker, available on npm.

This means we now have a number of options when it comes to capturing behavioural 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.
  • Build your own sp.js by following these instructions.
  • Completely rewritten in TypeScript, shipped with full type support.

Getting started

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 here: https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-trackers/javascript-tracker/v2-to-v3-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

Then…

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 updated documentation here: JavaScript Trackers (Web and Node.js) - Snowplow Docs

9 Likes

This is wonderful. I understand there is a lite version of the Snowplow script that supports Structured Events, but does the full version of the v3.x.x JS Tracker Snowplow Script support Structured Events?

Hi @sandraqu
The full version supports all the features that exist within the lite version, so you can use structured events with the full version :+1: