Appearance
Tag installation and options
Files
| File | Content | Size (gzip) |
|---|---|---|
ah.js | Core: autocapture, agent detection, consent, transport, cross-domain, ecommerce, GTM/gtag bridge | 16.8 KB |
ah.bridges.js | Matomo, Piano / AT Internet, Adobe, Segment / RudderStack and Meta bridges. Loaded on demand by the core when one of these tools is on the page. | 4.0 KB |
ah.full.js | Core + every bridge in one file (no extra request) | 19.1 KB |
ah.esm.js | ES module for bundlers | 18.8 KB before tree-shaking |
Use ah.full.js if you call Piano, AT Internet or Adobe methods in the very first milliseconds of the page: with ah.js, a method call made before ah.bridges.js has loaded is missed. Queued tools (_paq, fbq, Segment's stub, dataLayer) lose nothing either way.
Async snippet
html
<script>
(function (w, d, s, u, p) {
w.eureka = w.eureka || function () { (w.eureka.q = w.eureka.q || []).push(arguments); };
var j = d.createElement(s), f = d.getElementsByTagName(s)[0];
j.async = 1; j.src = u; j.setAttribute('data-pid', p);
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'https://cdn.eureka-analytics.com/eureka.js', 'AH-XXXXXX');
</script>Calls to ah(...) made before the script loads are queued and replayed, like gtag() and _paq. window.ahq.push([...]) works too.
A plain tag works as well:
html
<script async src="https://cdn.eureka-analytics.com/eureka.js" data-pid="AH-XXXXXX"></script>Script attributes
| Attribute | Default | Meaning |
|---|---|---|
data-pid | — | Property ID (required) |
data-collector | the script's own origin | Collector origin, for example https://collect.example.com |
data-consent | cookieless | Mode before any consent signal: full, cookieless or none |
data-domains | — | Cross-domain targets, comma-separated |
data-cookie-domain | registrable domain | Cookie domain override |
data-remote-config="0" | on | Disable the remote configuration fetch |
data-debug="1" | off | Log every event to the console |
Configuration with eureka('config', …)
Call it before the script loads (it is queued) or set the same options in the bundler init():
js
eureka('config', {
consent: 'cookieless', // mode before any signal
deniedMode: 'cookieless', // mode after a refusal: 'cookieless' or 'none'
respectGpc: true, // Global Privacy Control => denied mode
respectDnt: false, // Do Not Track => denied mode
cmp: true, // read TCF, Consent Mode, Didomi, OneTrust, Axeptio, Cookiebot
axeptioVendor: 'ah_analytics',
domains: ['shop.example.com', 'pay.example.com'],
cookieDomain: 'example.com',
sessionTimeoutMin: 30,
piiParams: ['email', 'mail', 'tel', 'phone', 'token', 'password', 'pwd'],
hashRouting: false, // count #/routes as pages
autocapture: { pageview: true, click: true, forms: true, scroll: true, errors: true, vitals: true },
bridges: { dl: true, gtag: true, paq: true, pa: true, atag: true, adobe: true, segment: true, fbq: true, pageviews: false },
});Settings made in the page take precedence over the remote configuration, except detect.signatures and detect.thresholds.
Remote configuration
Unless data-remote-config="0", the tag fetches GET {collector}/v1/config/{pid}.json (waiting at most 1.5 s) and merges it into its configuration. The property's settings in Admin (consent defaults, cross-domain list, bridges, autocapture) are delivered this way, and so are new agent detection signatures, without redeploying the tag.
Bundlers (ESM)
ts
import { init, installPluginBridges } from '@eureka-analytics/tag'
const ah = init({ pid: 'AH-XXXXXX', collector: 'https://collect.example.com' }, installPluginBridges)
eureka('event', 'newsletter_signup', { position: 'footer' })Pass installPluginBridges to include the Matomo, Piano, AT Internet, Adobe, Segment and Meta bridges statically.
Cookies and storage
| Name | Where | Content | Lifetime | Mode |
|---|---|---|---|---|
_ah_id | 1st-party cookie | Visitor ID, creation date, session count | 13 months from creation, never extended | full only |
_ah_s | 1st-party cookie + sessionStorage | Session ID, start, last activity, campaign, actor segment | 30 min sliding | full only |
_ah_outbox | localStorage | Unsent batches (≤ 30, 24 h) | — | full only |
_ah_optout | 1st-party cookie | 1 | 13 months | always (strictly necessary) |