Script configuration
The tracker is configured with data-* attributes on its script tag. All of them are optional except data-website-id.
| Attribute | Default | Description |
|---|---|---|
data-website-id | — | Your website id (required). |
data-domain | current hostname | Root domain. Cookies are scoped to it so all its subdomains share a visitor; links to other domains are tracked as exit links. |
data-api-url | <script origin>/api/events | Where events are sent. Set it when you proxy the script under a path of your own domain. |
data-allow-localhost | false | Track visits on localhost and *.local hosts. |
data-cookieless | false | Don't set any cookie. See cookieless mode. |
data-allow-file-protocol | false | Track pages opened from file:// (Electron, local HTML). Events are accepted when data-domain is your website domain. |
data-disable-scroll | false | Disable scroll goals. |
data-debug | false | Log tracker decisions in the browser console. |
Single-page apps
The script listens to history.pushState, history.replaceState and popstate, and sends a pageview whenever the path changes. You don't need any router integration. Changes to the query string or hash alone don't create a new pageview.
Outbound links
Clicks on links to other domains are recorded automatically as an outbound_link event with the target URL and the link text. They show up in Path → Exit link.
Calling the API before the script loads
The script is loaded with defer, so calls to window.dataeasy() made earlier would be lost. Add this stub before the script tag: calls are queued and replayed once the tracker loads.
<script>
window.dataeasy = window.dataeasy || function () {
(window.dataeasy.q = window.dataeasy.q || []).push(arguments);
};
</script>Cookies
| Cookie | Lifetime | Purpose |
|---|---|---|
dataeasy_visitor_id | 1 year | Random visitor id, used for unique visitors and revenue attribution. |
dataeasy_first_seen | 1 year | Date of the first visit (new vs returning visitors). |
dataeasy_session | 30 minutes | Session id and last activity time (sliding expiry). |
All cookies are first-party, SameSite=Lax, and Secure on HTTPS. Depending on where your visitors are, you may need their consent before loading the script: see the privacy policy and the DPA.
Cookieless mode
Add data-cookieless="true" to the script tag and the tracker stores nothing in the browser: no cookies and no local storage. The server derives an anonymous visitor id from a hash of the visitor's IP address, user agent, your website and the current day (with a secret salt). The IP address is never stored, and the id changes every day, so a visitor can't be followed across days.
<script
defer
data-website-id="YOUR_WEBSITE_ID"
data-domain="yourdomain.com"
data-cookieless="true"
src="https://dataeasy.app/js/script.js"
></script>Trade-offs to know about:
- A visitor coming back on another day counts as a new visitor, so unique visitors over long periods are higher.
- Sessions are grouped in 30-minute windows instead of a sliding 30-minute timeout.
- Revenue attribution can't read a
dataeasy_visitor_idcookie at checkout, so payments are not linked to a source in this mode. - Visitors behind the same IP address with the same browser on the same day count as one visitor.