Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. Javascript Tracker
  6. Snowplow Plugin for analytics NPM package

Snowplow Plugin for analytics NPM package

The Snowplow JavaScript Tracker can now be deployed directly into your web and node applications using the analytics and @analytics/snowplow NPM packages.

This is particularly useful for Modern Web Applications built with Single Page Application frameworks such as React, Angular or Vue. It’s also a great package if sending events to multiple platforms.

Quick Start

npm install analytics npm install @analytics/snowplow

Initialise the plugin:

import Analytics from 'analytics' import snowplowPlugin from '@analytics/snowplow' const analytics = Analytics({ app: 'awesome-app', plugins: [ // Minimal recommended configuration snowplowPlugin({ name: 'snowplow', scriptSrc: '//*.cloudfront.net/2.14.0/sp.js', collectorUrl: 'collector.mysite.com', trackerSettings: { appId: 'myApp', contexts: { webPage: true } } }) ] })

Then track a page view event:

analytics.page()

Full documentation

Snowplow Plugin documentation (getanalytics.io)

Analytics package documentation (getanalytics.io)