Integration guide
Add one script tag to start counting pageviews. Everything else on this page is optional.
Quick start
Paste this into the <head> of every page, and replace YOUR_SITE_ID with the ID from your site's settings.
<script defer data-site="YOUR_SITE_ID" src="https://cdn.invoker.app/script.js"></script>The script is about 3.5 KB gzipped and loads with defer, so it never blocks rendering. Platform-specific steps (WordPress, Shopify, Webflow, Next.js and more) are in the installation docs.
Configuration
Add any of these attributes to the script tag.
| Attribute | Default | What it does |
|---|---|---|
data-site | required | Your site ID, shown in your site's settings. |
data-spa | off | Track route changes in single-page apps: history, hash or auto. |
data-included-domains | all | Comma-separated hostnames to track on; others are ignored. |
data-excluded-domains | none | Comma-separated hostnames never to track on, e.g. staging or localhost. |
data-honor-dnt | false | Skip tracking when the browser sends Do Not Track. |
data-canonical | true | Record the canonical URL when the page declares one. |
data-auto | true | Send a pageview automatically on load. Set false to call trackPageview() yourself. |
data-outbound-links | true | Record clicks on links to other sites. |
data-file-downloads | true | Record clicks on links to files (pdf, zip, csv and more). |
data-download-extensions | common files | Comma-separated extensions that count as downloads. |
data-404-errors | true | Record visits to pages that look like a 404. |
data-tracker | https://api.invoker.app | Send data to a different collection endpoint. Only needed if we gave you one. |
<script defer
data-site="YOUR_SITE_ID"
data-spa="auto"
data-excluded-domains="localhost,staging.example.com"
src="https://cdn.invoker.app/script.js"></script>JavaScript API
Once the script has loaded, window.invoker exposes these methods.
invoker.trackEvent(name, properties?)
Record a custom event, with optional properties.
window.invoker.trackEvent('signup', { plan: 'starter', source: 'homepage' })invoker.trackGoal(code, cents?)
Record a goal conversion. Pick any short code; it appears in the Goals report the first time it's sent. The value in cents is optional.
window.invoker.trackGoal('PURCHASE', 4999) // $49.99invoker.trackRevenue({ amount, currency?, transaction_id?, items? })
Record revenue for the revenue report. Currency defaults to USD.
window.invoker.trackRevenue({ amount: 49.99, currency: 'EUR', transaction_id: 'order_1042' })invoker.trackPageview({ url?, referrer?, title? })
Send a pageview manually, for example with data-auto="false".
window.invoker.trackPageview({ url: '/checkout/step-2' })invoker.blockTrackingForMe() / enableTrackingForMe()
Stop counting your own visits in this browser (stored in localStorage), or start again.
window.invoker.blockTrackingForMe()What the script sends and stores
- Page URL, title and referrer, UTM and common campaign parameters, screen and viewport size.
- Browser, OS and device type (from the user agent) and approximate location (from the IP, via a local DB-IP database).
- The events, goals and revenue you send, plus outbound link, file download and 404 events if enabled.
- A random first-party visitor ID (
invoker_cid) and session ID (invoker_session) in localStorage. If storage is blocked, a browser fingerprint hash is used instead. - Do Not Track is a per-site setting in your dashboard. Visitor IP addresses are never stored; they're used only for location lookup and blocking.
There are no third-party cookies and no cross-site tracking. Depending on your jurisdiction you may still need consent; the Cookie Policy lists every storage key.