Skip to content

Tag installation and options ​

Files ​

FileContentSize (gzip)
ah.jsCore: autocapture, agent detection, consent, transport, cross-domain, ecommerce, GTM/gtag bridge16.8 KB
ah.bridges.jsMatomo, 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.jsCore + every bridge in one file (no extra request)19.1 KB
ah.esm.jsES module for bundlers18.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 ​

AttributeDefaultMeaning
data-pid—Property ID (required)
data-collectorthe script's own originCollector origin, for example https://collect.example.com
data-consentcookielessMode before any consent signal: full, cookieless or none
data-domains—Cross-domain targets, comma-separated
data-cookie-domainregistrable domainCookie domain override
data-remote-config="0"onDisable the remote configuration fetch
data-debug="1"offLog 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 ​

NameWhereContentLifetimeMode
_ah_id1st-party cookieVisitor ID, creation date, session count13 months from creation, never extendedfull only
_ah_s1st-party cookie + sessionStorageSession ID, start, last activity, campaign, actor segment30 min slidingfull only
_ah_outboxlocalStorageUnsent batches (≤ 30, 24 h)—full only
_ah_optout1st-party cookie113 monthsalways (strictly necessary)

Agents & humans, every visit counts!