Skip to content
Docs
Browse Developers

Tag reference

Every script attribute, JavaScript function, HTML attribute and cookie of Kontala's website tag.

The snippet

<script async src="https://konta.la/v1/t.js?k=pk_live_..."></script>

The script must stay a classic script: never add type="module".

Script attributes

Add these to the script tag to change how it behaves.

AttributeDefaultWhat it does
data-spaonSend a page view for each change of page in a single-page app. Set false to count full page loads only.
data-consentgrantedThe consent state before your code says otherwise: granted, unknown or denied. See Consent.
data-consent-hold10000How long, in milliseconds, events wait for an answer while consent is unknown.
data-disable-storageoffRun without cookies: ids are kept in memory for the page only.
data-session-timeout30Minutes without activity before a visit ends.
data-device-max-age63072000Seconds the device cookie lasts.
data-cookie-prefixpt_Prefix for the tag's cookie names.
data-cookie-domainthis hostSet a parent domain, such as example.com, to share visits across subdomains.
data-cookie-path/Cookie path.
data-cookie-samesiteLaxCookie SameSite. None forces Secure.
data-cookie-secureon HTTPSCookie Secure flag.
data-max-batch-events20Most events in one request.
data-endpointfrom the script's addressWhere events are sent, for a first-party proxy.
data-debugoffLog every captured event to the console, and warn about delivery problems.

Boolean attributes are on when present, or when set to true, 1, on or yes.

JavaScript functions

FunctionWhat it does
pageTracker.consent(state)Set consent to 'granted', 'denied' or 'unknown'.
pageTracker.getConsent()Return the current consent state.
pageTracker.identify({ user, org })Name the signed-in user and their organisation. identify({}) signs them out.
pageTracker.pageType(type)Declare the current page's type, such as 'pdp'.

All of them live on window.pageTracker once the tag has loaded. Before then, push calls onto a queue, and the tag runs them in order when it starts:

window.pageTrackerQueue = window.pageTrackerQueue || [];
window.pageTrackerQueue.push(['consent', 'granted']);
window.pageTrackerQueue.push(['identify', { user: 'user-42' }]);
window.pageTrackerQueue.push(['pageType', 'checkout']);

HTML attributes

AttributeWhat it does
data-ac-event="add_to_cart"Declares what a click on this element, anything inside it, or its form does. Use a click type code.
data-ac-ignoreLeaves out every click, swipe and friction signal inside this element.
data-ac-maskKeeps only that something inside this element was clicked or swiped.

Cookies

CookieHoldsLasts
pt_didThe anonymous device id2 years, or less where the browser caps it
pt_sidThe visit's id and when it was last active30 minutes after the last activity

To join a server-side event to a browser visit, read pt_did and the part of pt_sid before the dot.

Sending

The tag sends with navigator.sendBeacon, or fetch with keepalive where that is not available, as plain text so there is never a CORS preflight. It sends what it holds when the page is hidden or closed, and never uses the unload event, so your pages stay eligible for the browser's back and forward cache.

Was this helpful?