Add the tracker
Installation
Section titled “Installation”Add the following snippet to the <head> of every page you want to track:
<script defer data-domain="yourdomain.com" src="https://app.metrixs.eu/tracker.js"></script>Replace yourdomain.com with your site’s domain (must match what you registered in MetriXs).
Options
Section titled “Options”| Attribute | Description |
|---|---|
data-domain |
Required. Your site domain |
data-local-dev |
Set to track on localhost (disabled by default) |
Custom events
Section titled “Custom events”Beyond automatic pageviews, you can fire custom events for anything you want to measure — button clicks, video plays, form submissions, scroll milestones. Custom events appear in your dashboard and carry their own properties.
// Fire a custom event with propertiesmetrixs('Signup CTA Click', { props: { location: 'hero' } })Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
name |
string |
— | The event name (e.g. 'Signup CTA Click'). Use 'pageview' for a manual pageview. |
props |
object |
{} |
Custom properties to attach to the event. |
url |
string |
location.href |
Override the page URL recorded for this event (useful for SPA route changes). |
interactive |
boolean |
true |
Set to false for passive signals that should not count as a real interaction (so they don’t lower bounce rate). The built-in scroll-depth/engagement events use this. |
callback |
function |
— | Called after the event is sent. |
// Non-interactive signal — extends visit duration without affecting bounce ratemetrixs('scroll_to_bottom', { props: { article: 'gdpr' }, interactive: false })Custom events that fire during a visit also extend its measured duration, because duration is calculated as the time between the first pageview and the last event. See Visit duration for why this matters.
Auto-tracked events
Section titled “Auto-tracked events”The full tracker also captures three event types automatically — no setup required:
| Event name | When it fires | Property |
|---|---|---|
Outbound Link: Click |
A visitor clicks a link to an external domain | url |
File Download |
A visitor clicks a link to a file (pdf, zip, mp4, …) | url |
404 |
A 404 page — only if the page sets <meta name="metrixs:404" content="true"> |
path |
These surface in their own Auto-tracked Events card on the dashboard. To capture 404s, add the meta tag to your 404 page template:
<meta name="metrixs:404" content="true" />The lite tracker (
tracker.lite.js) omits auto-tracking — pageviews only. Use the fulltracker.jsif you want outbound links, downloads, and 404s.
See Custom events for how to view and break them down in the dashboard.
Self-exclusion
Section titled “Self-exclusion”To exclude your own visits, run this in your browser console:
localStorage.setItem('metrixs_ignore', 'true')Lightweight version
Section titled “Lightweight version”For minimal bundle size, use the lite tracker:
<script defer data-domain="yourdomain.com" src="https://app.metrixs.eu/tracker.lite.js"></script>