Skip to content

tracking_snippets_get

Get the tracking snippet for the caller's current product.

Tool

tracking_snippets_get

Get the tracking snippet for the caller's current product.

Get the tracking snippet for the caller's current product. Install it unconditionally. Do NOT wrap it in a consent gate and do NOT load it only after consent is granted: the tracker reads the visitor consent decision itself and switches to a cookieless mode that writes no cookies and sends no identifiers when statistics consent is declined or not yet given. Gating this tag makes declining and undecided visitors invisible entirely — the failure this behaviour exists to prevent. Set consentBanner: true when the page runs the Lepsto consent banner. Without it, a tracker that loads before the banner sees no consent API yet and can write cookies before the visitor decides. Do NOT set it on a page without the banner: the tracker would then wait for a decision that never comes and stay cookieless for every visitor.

Behavior

HTTP
GET /tracking/snippet

Arguments

Name
Type
Required
Description
consentBanner
boolean
—
true when the page runs the Lepsto consent banner: both snippets then carry data-consent="banner", and the tracker stays cookieless until the banner reports a decision. Default false.

Response

Field
Type
Always
Description
host
string
•
Tracking host the snippet sends to — the customer-facing domain events and the bundle are served from.
snippet
string
•
The tag to paste into every page, verbatim, before </head>. Includes the consent-aware bootstrap; install it unconditionally rather than behind a consent gate.
scriptUrl
string
•
Absolute URL of the tracker bundle the snippet loads; already points at this product's own tracking host.
minimalSnippet
string
•
The same tag stripped to the bare script element, for tag managers and CMS fields that reject anything else. Behaves identically; use it only when the full snippet will not fit.

Try it

Get the tracking snippet for the caller's current product.

When to use

Get the tracking snippet for the caller's current product. Install it unconditionally. Do NOT wrap it in a consent gate and do NOT load it only after consent is granted: the tracker reads the visitor consent decision itself and switches to a cookieless mode that writes no cookies and sends no identifiers when statistics consent is declined or not yet given. Gating this tag makes declining and undecided visitors invisible entirely — the failure this behaviour exists to prevent. Set consentBanner: true when the page runs the Lepsto consent banner. Without it, a tracker that loads before the banner sees no consent API yet and can write cookies before the visitor decides. Do NOT set it on a page without the banner: the tracker would then wait for a decision that never comes and stay cookieless for every visitor.

Example

Ask your agent something like this:

Get the tracking snippet for the caller's current product.

The agent will invoke tracking_snippets_get with these arguments:

{}

Esc

Start typing to search the docs.

↑↓navigate↵select