Skip to main content

Timezone and geolocation tracking

Track users' timezone and geolocation with these configuration options.

Timezone

The timezone plugin allows the tracker to populate the os_timezone field within the canonical event model. This field has its own column in the data warehouse.

The timezone property is automatically tracked once configured.

Install plugin

Tracker DistributionIncluded
sp.js
sp.lite.js

Download:

Download from GitHub Releases (Recommended)Github Releases (plugins.umd.zip)
Available on jsDelivrjsDelivr (latest)
Available on unpkgunpkg (latest)

Note: The links to the CDNs above point to the current latest version. You should pin to a specific version when integrating this plugin on your website if you are using a third party CDN in production.

window.snowplow('addPlugin', 
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-timezone@latest/dist/index.umd.min.js",
["snowplowTimezone", "TimezonePlugin"]
);

Once configured, all subsequent events will contain this property.

Geolocation

If this plugin is enabled, the tracker will attempt to create a context from the visitor’s geolocation information. If the visitor has not already given or denied the website permission to use their geolocation information, a prompt will appear. If they give permission, then all events from that moment on will include their geolocation information, as a context entity.

If the geolocation context isn't enabled at tracker initialization, then it can be enabled at a later time by calling enableGeolocationContext. This is useful if you have other areas of your site where you require requesting geolocation access, as you can defer enabling this on your Snowplow events until you have permission to read the users geolocation for your other use case.

For more information on the geolocation API, see the specification.

Geolocation context entities are automatically tracked once configured.

Install plugin

Tracker DistributionIncluded
sp.js
sp.lite.js

Download:

Download from GitHub Releases (Recommended)Github Releases (plugins.umd.zip)
Available on jsDelivrjsDelivr (latest)
Available on unpkgunpkg (latest)

Note: The links to the CDNs above point to the current latest version. You should pin to a specific version when integrating this plugin on your website if you are using a third party CDN in production.

window.snowplow('addPlugin', 
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-geolocation@latest/dist/index.umd.min.js",
["snowplowGeolocation", "GeolocationtPlugin"],
[false] // Enable at load
);

Context entity

Adding this plugin will automatically capture this context entity.

Example geolocation data

{
"latitude": 51.507351,
"longitude": -0.127758,
"latitudeLongitudeAccuracy": 150,
"altitude": 93.03439331054688,
"altitudeAccuracy": 10,
"bearing": null,
"speed": null,
"timestamp": 1617139404224
}
Was this page helpful?