Back to Docs
Installation

Tracking Script Options

1 min read
Tracking Script Options

Customizing the Tracking Script

The tracking snippet accepts optional data-* attributes that change how it behaves. The basic snippet only needs src and data-website-id; everything below is optional.

<script defer src="https://app.eurometrics.eu/script.js"
        data-website-id="YOUR_WEBSITE_ID"></script>

Available Attributes

Attribute

What it does

data-website-id

Required. The ID of the website in EuroMetrics.

data-host-url

Send collected data to a specific host instead of the script’s origin.

data-auto-track

Set to false to disable automatic pageview tracking (you then track manually via the JavaScript API).

data-do-not-track

Set to true to respect the browser’s “Do Not Track” setting and skip those visitors.

data-exclude-search

Set to true to strip query strings (everything after ?) from recorded URLs.

data-exclude-hash

Set to true to ignore the URL fragment (everything after #).

data-domains

Comma-separated list of domains the tracker is allowed to run on.

data-tag

Attach a tag to all events from this script, useful for grouping (e.g. environment or campaign).

data-consent-position

Consent banner position: bottom, left, or right.

data-privacy-policy

URL of your privacy policy for the consent banner.

data-controller-name

Legal name of the data controller shown in the consent banner.

Examples

Ignore query strings (so /page?utm=... and /page are counted as one):

<script defer src="https://app.eurometrics.eu/script.js"
        data-website-id="YOUR_WEBSITE_ID"
        data-exclude-search="true"></script>

Disable automatic pageviews and track manually with the JavaScript API:

<script defer src="https://app.eurometrics.eu/script.js"
        data-website-id="YOUR_WEBSITE_ID"
        data-auto-track="false"></script>

A Note on UTM Parameters

Even though data-exclude-search removes query strings from the page URL, campaign parameters (utm_source, utm_medium, etc.) are still parsed for the UTM report before being stripped — so you can keep clean page URLs and still measure campaigns.

What’s Next?


Need help? Reach out to us at support@eurometrics.eu.

Ready to get started?

Create your free account and start tracking in minutes.

Start Free