Script options

Configure the attribu.tech pixel using data- attributes on the script tag.

All options

AttributeRequiredDescription
data-website-idYesYour site UUID from the attribu.tech dashboard
data-domainYesYour root domain (e.g. example.com). Used for cookie scoping and cross-domain tracking.
data-api-urlNoCustom API endpoint. Useful if you're proxying the API through your own domain to avoid ad blockers.
data-allowed-hostnamesNoComma-separated list of additional domains for cross-domain tracking.
data-allow-localhostNoSet to "true" to enable tracking on localhost (disabled by default).
data-disable-paymentsNoSet to "true" to disable automatic Stripe Payment Link detection.
data-calendar-domainsNoComma-separated custom calendar domains for booking attribution.

Example with all options

<script
  defer
  data-website-id="550e8400-e29b-41d4-a716-446655440000"
  data-domain="example.com"
  data-allowed-hostnames="app.example.com,shop.example.com"
  data-calendar-domains="book.example.com"
  data-allow-localhost="true"
  src="https://attribu.tech/js/script.js"
></script>

Proxying the script

Some ad blockers may block requests to attribu.tech. To avoid this, you can proxy both the script and the API through your own domain:

1. Proxy the script file

Set up a reverse proxy or rewrite rule so that yourdomain.com/js/script.js serves the attribu.tech script. For example, in Vercel's vercel.json:

{
  "rewrites": [
    {
      "source": "/js/attribu.js",
      "destination": "https://attribu.tech/js/script.js"
    },
    {
      "source": "/api/proxy/events",
      "destination": "https://attribu.tech/api/events"
    }
  ]
}

2. Update the script tag

<script
  defer
  data-website-id="YOUR_SITE_ID"
  data-domain="yourdomain.com"
  data-api-url="/api/proxy/events"
  src="/js/attribu.js"
></script>
The pixel automatically detects if it's not loaded from attribu.tech and will usewindow.location.origin/api/events as the API endpoint, so if you proxy the API to that path, you may not even need data-api-url.

Heartbeat

The pixel sends a lightweight heartbeat ping every 30 seconds while the tab is visible. This powers the real-time visitor count on the globe view. The heartbeat automatically pauses when the tab is hidden and resumes when it becomes visible again.

Copied