Use this guide to install Dashtics, track custom actions, and record ecommerce without cookies or cross-site fingerprinting.
Once the script is installed, Dashtics records pageviews automatically. You can then add custom events and ecommerce on top.
Pageviews
Tracked on load and on SPA route changes.
Custom events
Track clicks, form submissions, downloads, and more.
Ecommerce
Record purchases, revenue, currency, and product metadata.
1. Install the script
Place the script in the <head> of your site. Use the same snippet for static pages, server-rendered templates, and SPAs.
Example 1: static HTML site
<script src="https://dashtics.eu/static/script.js"
data-site="YOUR_SITE_TOKEN"
async></script>
Example 2: server-rendered base layout
<head>
<script src="https://dashtics.eu/static/script.js"
data-site="YOUR_SITE_TOKEN"
async></script>
</head>
Example 3: SPA root template
<body>
<div id="app"></div>
<script src="https://dashtics.eu/static/script.js"
data-site="YOUR_SITE_TOKEN"
async></script>
</body>
2. Track custom actions
Use window.analytics.track() for actions that are not pageviews. Pass properties when you want to filter or segment later.
Example 1: CTA click
window.analytics.track('cta_click', {
location: 'hero',
label: 'Start free trial'
});
Example 2: form submission
window.analytics.track('lead_form_submit', {
form: 'contact',
plan: 'pro'
});
Example 3: download or content action
window.analytics.track('pdf_download', {
title: 'Tracking Guide',
format: 'pdf'
});
3. Track ecommerce
Call window.analytics.purchase() on the order confirmation page or right after payment succeeds. Fire it once per order.
Example 1: one-time purchase
window.analytics.purchase('ord_12345', 49.95, 'EUR');
Example 2: subscription upgrade
window.analytics.purchase('sub_98765', 29.00, 'EUR', {
product_name: 'Pro Plan'
});
Example 3: order with extra product data
window.analytics.purchase('ord_55555', 149.00, 'EUR', {
product_name: 'Agency Bundle',
product_id: 'bundle_agency',
quantity: 3
});
collect.POST /collect returns 202 Accepted.