Dashtics
Home › Tracking Guide

Tracking Guide

Use this guide to install Dashtics, track custom actions, and record ecommerce without cookies or cross-site fingerprinting.

What Dashtics tracks automatically

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

Add Dashtics to every page

Place the script in the <head> of every page. If you use WordPress, the Code Snippets plugin is a simple way to add it once and load it site-wide.

Example: static HTML site

HTML
<script src="https://dashtics.eu/static/script.js"
        data-site="YOUR_SITE_TOKEN"
        async></script>

WordPress: Code Snippets plugin

Create a new PHP snippet, set it to run everywhere, and hook the script into wp_head. That keeps the tag in the <head> without editing your theme files.

  1. Install and activate the Code Snippets plugin.
  2. Go to Snippets → Add New and choose a PHP snippet.
  3. Paste the code below, set it to run everywhere, then save and activate.
PHP
<?php
add_action('wp_head', function () {
    echo '<script src="https://dashtics.eu/static/script.js" data-site="YOUR_SITE_TOKEN" async></script>';
});

2. Track custom actions

Measure the actions that matter

Use window.analytics.track() for actions that are not pageviews. Pass properties when you want to filter or segment later.

Example 1: CTA click

JavaScript
window.analytics.track('cta_click', {
  location: 'hero',
  label: 'Start free trial'
});

Example 2: form submission

JavaScript
window.analytics.track('lead_form_submit', {
  form: 'contact',
  plan: 'pro'
});

Example 3: download or content action

JavaScript
window.analytics.track('pdf_download', {
  title: 'Tracking Guide',
  format: 'pdf'
});

3. Track ecommerce

Record purchases and revenue

Call window.analytics.purchase() on the order confirmation page or right after payment succeeds. Fire it once per order.

Example 1: one-time purchase

JavaScript
window.analytics.purchase('ord_12345', 49.95, 'EUR');

Example 2: subscription upgrade

JavaScript
window.analytics.purchase('sub_98765', 29.00, 'EUR', {
  product_name: 'Pro Plan'
});

Example 3: order with extra product data

JavaScript
window.analytics.purchase('ord_55555', 149.00, 'EUR', {
  product_name: 'Agency Bundle',
  product_id: 'bundle_agency',
  quantity: 3
});

Verify it is working

  1. Open your site in a browser and load a page.
  2. Open DevTools, go to Network, and filter for collect.
  3. Confirm that POST /collect returns 202 Accepted.