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 Trackers (Web and Node.js)
  6. Browser Tracker
  7. Quick start guide

Quick start guide

Getting started with sending events using the Browser Tracker will be familiar for anyone who is used to installing npm packages into their web apps and is designed to work with frameworks such as React, Angular and Vue.

The process involves the following high level steps:

  • Install the @snowplow/browser-tracker package using your preferred package manager
    • npm install @snowplow/browser-tracker
    • yarn add @snowplow/browser-tracker
    • pnpm add @snowplow/browser-tracker
  • You can then import this library into your application
import { newTracker, trackPageView } from "@snowplow/browser-tracker";
Code language: JavaScript (javascript)
  • Configure an instance of the tracker by calling newTracker(...) with your desired properties. This will create a module level instance of your tracker. You don’t need to keep a reference to it.
newTracker('sp1', '{{collector_url}}', { appId: 'my-app-id', plugins: [ ], })
Code language: JavaScript (javascript)
  • Then you can use the track methods to send some events. You can send a Page View event to all initialised trackers with just:

If you’d like to learn more about Snowplow BDP you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.