Talivia Docs
Talivia Docs
HomeDashboard
IntroductionInstallationGetting updates
Tracking overviewTracker functionsTracker configurationTrack eventsDistinct IDsTagsLinksPixels
Tracking

Tracker configuration

Configure the Talivia tracker with data attributes.

The tracker reads configuration from data-* attributes on the script tag.

<script
  defer
  src="https://talivia.com/script.js"
  data-website-id="YOUR_WEBSITE_ID"
  data-auto-track="true"
></script>

Available attributes

AttributeDescription
data-website-idRequired website id.
data-host-urlOverride the collection host. Usually not needed on Talivia Cloud.
data-auto-trackSet to false to disable the first automatic page view.
data-domainsComma-separated hostnames allowed to send data.
data-do-not-trackSet to true to respect browser Do Not Track.
data-exclude-searchSet to true to remove query strings before sending URLs.
data-exclude-hashSet to true to remove hash fragments before sending URLs.
data-tagAttach a tag to every event from this script.
data-before-sendName of a global function that can edit or cancel payloads.
data-fetch-credentialsFetch credentials mode. Defaults to omit.
data-performanceSet to true to collect Web Vitals.

beforeSend

<script>
  window.taliviaBeforeSend = (type, payload) => {
    if (payload.url?.includes('/internal-preview')) return null;

    return payload;
  };
</script>

<script
  defer
  src="https://talivia.com/script.js"
  data-website-id="YOUR_WEBSITE_ID"
  data-before-send="taliviaBeforeSend"
></script>

Return null or undefined to cancel the event.

Domain allowlist

<script
  defer
  src="https://talivia.com/script.js"
  data-website-id="YOUR_WEBSITE_ID"
  data-domains="example.com,app.example.com"
></script>

This is useful when the same layout can render on staging, preview, and production domains.

Tracker functions

Previous Page

Track events

Next Page