Skip to main content

Tracking your first events

Once your pipeline is set up, you will want to send some events to it. Here’s an overview of the different options.

Latency

Regardless of how you send the events, it might take a few minutes for them to reach your destination (e.g. data warehouse). This depends on which destination and loader you have configured.

A quick test​

If you are eager to look at some Snowplow events or just test your pipeline, you can use the box below to send some data (including failed events) to your Collector.

HTTPS

Note that to use this tool, you need a Collector URL that starts with https://, not http://. This is because web browsers block traffic from HTTPS-enabled sites (such as https://docs.snowplow.io — this site — to non-HTTPS resources).

You can find the Collector URL (Collector Endpoint) in the Console.

Which events are sent?
We use the following tracking code:
window.snowplow('trackSelfDescribingEvent',
{
event: {
schema: 'iglu:com.snowplowanalytics.snowplow/add_to_cart/jsonschema/1-0-0',
data: { sku: 'ASO01043', unitPrice: 49.95, quantity: 1000 }
}
}
)
window.snowplow('trackSelfDescribingEvent',
{
event: {
schema: 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1',
data: {
targetUrl: 'https://snowplow.io'
}
}
}
)
window.snowplow('trackSelfDescribingEvent',
{
event: {
schema: 'iglu:com.snowplowanalytics.mobile/deep_link/jsonschema/1-0-0',
data: {
url: 'https://snowplowanalytics.com'
}
}
}
)
window.snowplow('trackSelfDescribingEvent',
{
event: {
schema: 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1',
data: {
targetUrl: 'https://snowplow.io'
}
},
context: [
{
schema: 'iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0',
data: {
id: '6a2a8c7c-8e7a-4e9f-9b4c-0f4f9a3f35a9'
}
}
]
}
)
window.snowplow('trackPageView', undefined)
window.snowplow('trackPageView', { title: 'My custom page title' })

// Bad Events
window.snowplow('trackSelfDescribingEvent',
{
event: {
schema: 'iglu:com.fake_event/event/jsonschema/1-0-0',
data: { foo: 'bar' }
}
}
)
window.snowplow('trackSelfDescribingEvent',
{
event: {
schema: '',
data: {}
}
}
)
window.snowplow('trackSelfDescribingEvent',
{
event: {
schema: 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1',
data: {
invalidProperty: "This schema doesn't have this property"
}
}
}
)
Application ID

An application ID is sent along with each Snowplow event. You can pick a value that will make it easy to filter out these test events from your data later, e.g. like this:

...
WHERE app_id != 'test'
...

Now, let’s take a look at how to set up actual event tracking.

Using the JavaScript tracker​

The JavaScript tracker is our most commonly used tracker. It’s a good choice for websites, and the installation process is similar to other tools like Google Analytics.

To use the JavaScript tracker on your site, you will need to obtain a code snippet first.

BDP Enterprise can automatically generate the snippet for you. Go to the tag generator screen, fill in the necessary parameters, and copy the snippet at the bottom.

Once you have the snippet, there are two common ways to deploy it.

If you have access to the source code of your site, paste the snippet into the <head> HTML section and deploy the changes.

The JavaScript tracker captures many events (e.g. page views) automatically, so you should start accumulating your first events as soon as the changes are rolled out to your users.

Strong user and session cookies and ad-blocker mitigation

To make sure that your tracking is well configured for strong first-party cookies and resilient against the impact of ad-blockers, visit this page with several useful recommendations.

Using other trackers​

We have many different trackers in different programming languages, in case the JavaScript tracker is not a fit for you. For example, see the mobile native trackers or the full list of what’s available.

tip

For quick testing, you might be tempted to send data to your Collector URL using a basic command-line tool like cURL. However, you would need to ensure that the data format follows our tracker protocol. Instead, take a look at the command-line tracker that will do this for you.