Install the script
View as MarkdownAdd the Reveata snippet to your site and choose the options you need.
On this page
Add your website in the dashboard, then copy the snippet it shows. It already contains your website’s tracking id. Paste it inside the <head> of every page:
<script defer data-website-id="ws_your_tracking_id" src="https://reveata.com/js/script.js"></script>The script loads with defer, so it never blocks your page, and it never throws errors into your site. Pageviews start arriving as soon as a visitor opens a page. Single-page apps are handled automatically: the script records a pageview on every history.pushState, replaceState and back/forward navigation.
For framework-specific instructions see Frameworks and site builders.
Options
Add any of these attributes to the <script> tag. Loaders that can’t set attributes (tag managers, some site builders) can pass the same options in the script address without the data- prefix, for example https://reveata.com/js/script.js?website-id=ws_your_tracking_id&cookieless=true. Attributes win when both are set.
| Attribute | Default | What it does |
|---|---|---|
data-website-id |
required | Your website’s tracking id (ws_…). |
data-cookieless |
false |
Do not store a visitor id in the browser. See Cookieless mode. |
data-domains |
none | Other root domains of the same website, comma separated. Links between them carry the visitor along so a visit across domains stays one visitor. |
data-exclude-paths |
none | Paths not to track, comma separated, * as a wildcard, e.g. /admin/*,/preview. |
data-scroll |
true |
Record how far people scroll on each page (sent when they leave, from 25% up). |
data-outbound |
true |
Record clicks on links to other sites. |
data-hash |
false |
Treat #/route changes as separate pages (hash-based routers). |
data-auto |
true |
Record pageviews automatically. Set to false to send them yourself with reveata('pageview'). |
data-respect-dnt |
false |
Do not track browsers that send Do Not Track or Global Privacy Control. |
data-allow-localhost |
false |
Track on localhost and *.localhost (off by default so development visits stay out of your numbers). |
data-allow-iframe |
false |
Track when the page is shown inside an iframe. |
data-api |
script origin + /api/collect |
Send events to a different endpoint, for example through your own proxy. |
data-debug |
false |
Log what the script does to the browser console. |
The script also reports how long each page stays visible (time on page) when the visitor leaves it.
Broken links (404), file downloads, form submissions and web vitals are opt-in and live in a second script, https://reveata.com/js/script.extras.js, with its own attributes (data-track-404, data-downloads, data-forms, data-vitals). See Custom goals.
You can also exclude IP addresses and paths for everyone in Settings → General → Exclusions. Those rules are applied on our server.
More on these options: subdomains, cross-domain tracking, hash-based routes, exclusions and UTM tags and ?ref.
Calling the script before it loads
The script exposes window.reveata. To call it before it has loaded (for example from an inline script), add this queue first. Calls are replayed once the script is ready:
<script>
window.reveata =
window.reveata ||
function () {
(window.reveata.q = window.reveata.q || []).push(arguments);
};
</script>Opting yourself out
The quickest way is Settings → General → Exclusions → Ignore this browser: it opens your site once with ?reveata_ignore=1, the script stores the flag in that browser and removes the parameter from the address (?reveata_ignore=0 undoes it). You can also do it yourself.
Run this once in your browser’s console on your site to stop counting your own visits on that browser, and reveata('optin') to undo it:
reveata('optout');