# Quick start guide for the web trackers
> Get started quickly with the JavaScript or Browser tracker to track page views and user activity on your website.
> Source: https://docs.snowplow.io/docs/sources/web-trackers/quick-start-guide/
> Documentation index: https://docs.snowplow.io/llms.txt

Follow these instructions to quickly implement a Snowplow web tracker with default configuration, and track a page view.

Using Signals? See [Send events to Signals](/docs/signals/data-sources/events/) and the [Signals browser plugin](/docs/signals/applications/subscribe/).

> **Tip: Use your AI assistant**
>
> If you use Snowplow CDI, you can ask a coding agent connected to the Snowplow MCP server to follow these steps for you, and to check that the page view arrives in your pipeline. For example: "Add the Snowplow web tracker to this app with default configuration, track a page view, and confirm it reaches my development pipeline."
>
> Install the [Snowplow MCP server](/docs/ai/snowplow-mcp/) and [skills](/docs/ai/skills/) in your coding agent, such as Claude Code, Cursor, or Codex, with `npx plugins add snowplow/skills`. In Console, the [Snowplow Assistant](/docs/ai/console-agent/) has the same tools.

**JavaScript (tag):**

Getting started with sending events using the JavaScript tracker is very similar to other web analytics vendors like Google Analytics, Adobe Analytics, etc.

The process involves the following high level steps:

- Download the latest version of the Snowplow JavaScript tracker file, `sp.js`, which can be found [here](https://github.com/snowplow/snowplow-javascript-tracker/releases).
- If you are already hosting static files somewhere on your own domain, it should just be a matter of downloading and adding the `sp.js` file. Otherwise you can follow our [guides for self hosting](/docs/sources/web-trackers/tracker-setup/hosting-the-javascript-tracker/), use another method of your choice, or leverage a [Third Party CDN](/docs/sources/web-trackers/tracker-setup/hosting-the-javascript-tracker/third-party-cdn-hosting/) (useful for evaluation or testing).
- Once you have a JS tracker available, you can add the tag snippet to your site. There are also alternative options described below for adding the tracker to your website.
- If manually inserting the tag into your website or tag management solution: Snowplow CDI customers can generate a tag snippet in Snowplow Console [here](https://console.snowplowanalytics.com/tag-generator). Other users can use and edit the standard tag [here](/docs/sources/web-trackers/tracker-setup/).

```javascript
 ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[]; p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","{{URL to sp.js}}","snowplow"));
```

- Once you’ve generated your tag add it to all the pages you’d like to track:

  - Place the tag directly into your codebase. Typically this will be placed into the `<head>` element of your page or in a similar, suitable, location if using a Single Page Application framework.
    - The tag loads asynchronously to avoid slowing down page load times. Tracking calls made before the script loads are automatically queued and processed once the tracker initializes.
  - Load the tag using a Tag Management solution such as Google Tag Manager, usually triggered on page load.

- Configure an instance of the tracker by calling `newTracker` with your desired properties.

```javascript
window.snowplow('newTracker', 'sp1', '{{collector_url}}', {
  appId: 'my-app-id'
})
```

- Then you can use the track methods to send some events. You can send a Page View event to all initialised trackers with just:

```javascript
window.snowplow('trackPageView');
```

Rather than adding the tag snippet directly, you may wish to use an alternative option for loading the JavaScript Tracker.

- Users of Google Tag Manager can use the [Snowplow Analytics Custom Template](/docs/sources/google-tag-manager/).

- Use the Snowplow Plugin in the [analytics npm package](/docs/sources/web-trackers/tracker-setup/snowplow-plugin-for-analytics-npm-package/).

**Browser (npm):**

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

```javascript
import { newTracker, trackPageView } from "@snowplow/browser-tracker";
```

- 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.

```javascript
newTracker('sp1', '{{collector_url}}', {
  appId: 'my-app-id',
  plugins: [ ],
})
```

- Then you can use the track methods to send some events. You can send a Page View event to all initialised trackers with just:

```javascript
trackPageView();
```

***

## What's tracked with the default configuration?

Using just the initialization snippets above won't result in any events, unless `trackPageView` is called.

However, we recommend that [activity tracking](/docs/sources/web-trackers/tracking-events/activity-page-pings/) (page pings) is enabled immediately following initialization.

**JavaScript (tag):**

```javascript
<!-- Snowplow starts plowing -->
<script type="text/javascript">
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","{{URL to sp.js}}","snowplow"));

snowplow('newTracker', 'sp', '{{collector_url_here}}', {
    appId: 'my-app-id',
});

snowplow('enableActivityTracking', {
  minimumVisitLength: 30,
  heartbeatDelay: 10
});

// snowplow('trackPageView') can then be called

</script>
<!-- Snowplow stops plowing -->
```

**Browser (npm):**

```javascript
import {
  newTracker,
  trackPageView
} from '@snowplow/browser-tracker';

newTracker('sp', '{{collector_url_here}}', {
    appId: 'my-app-id',
});

enableActivityTracking({
  minimumVisitLength: 30,
  heartbeatDelay: 10
});

// trackPageView() can then be called
```

***

Adding this code to your site will cause [page ping events](/docs/sources/web-trackers/tracking-events/activity-page-pings/) to be automatically tracked and sent via POST.

The events will all have the `webPage` entity attached, containing the [page view ID](/docs/sources/web-trackers/tracking-events/page-views/).
