Analytics — Privacy-Friendly Tracking Without Breaking Performance

Complete guide to adding analytics to Dax Pro: Plausible, Umami, Google Analytics, and self-hosted options. Installation, privacy compliance, cookie consent, custom events, and how to keep the Lighthouse 100 score intact.

Why Analytics Is Optional in Dax Pro

Dax Pro does not include analytics by default. This is a deliberate choice, not an oversight. There are three reasons:

1. Privacy. Every analytics tool is a tracking tool. Even privacy-focused analytics record visitor behavior. Some visitors do not want this. A site without analytics is a site that respects visitors by default.

2. Performance. Every analytics script is a network request. Even the smallest script adds 20–50 milliseconds of load time and one additional connection. Dax Pro's entire premise is that sites load in under 50 milliseconds; adding analytics changes that.

3. Simplicity. Analytics requires an account, a script tag, a consent banner in some jurisdictions, and ongoing maintenance. For a small site that gets 200 visitors per month, analytics adds more overhead than insight.

If you do not need analytics, do not add it. The site works fine without it. Track visitors via server logs if you want basic numbers, or use a simple counters service that requires no JavaScript.

If you do need analytics, this chapter covers the options and how to install them without breaking the Lighthouse score.

This chapter covers:

1. What to measure — which metrics actually matter

2. Plausible Analytics — the recommended choice for Dax Pro

3. Umami Analytics — the open-source alternative

4. Google Analytics — when you actually need it and how to install it responsibly

5. Where to place the script — how to add analytics without blocking rendering

6. Privacy compliance — cookies, GDPR, and consent banners

7. Custom events — tracking specific user actions

8. Verifying it works — how to confirm analytics is recording data


What to Measure

Before choosing a tool, decide which metrics matter. Most sites need less than they think.

Metrics that matter

Visitors per day/week/month. The most basic number. Tells you whether the site is growing.

Top pages. Which content attracts the most visitors. Tells you what to write more of.

Traffic sources. Where visitors come from: search engines, direct visits, social media, referral links. Tells you which channels work.

Bounce rate (or engagement rate). Whether visitors stay or leave immediately. A high bounce rate on a landing page may indicate the page does not match the search query.

Conversion events. What visitors do that matters: clicking a call-to-action, submitting a form, downloading a file. Tells you whether the site achieves its purpose.

Metrics that do not matter

Pageviews — the same visitor viewing five pages is not five visitors. Visitors are the metric, not views.

Time on page — the number is unreliable (a visitor who opens a page and walks away records ten minutes of "time on page"). Engagement rate (did they scroll? did they click?) is better.

Bounce rate on single-page sites — every visit is a bounce. The metric is meaningless for landing pages.

Live visitor counters — watching a real-time counter is addictive and useless. Look at weekly trends, not real-time data.

Individual user journeys — the identity of specific visitors is not important. Aggregate patterns matter.

Choose a tool that measures the metrics you need, not one that promises to measure everything. A tool that measures three useful metrics is better than a tool that measures fifty useless ones.


Plausible Analytics

Plausible is the recommended analytics tool for Dax Pro. It is:

  • Privacy-focused — no cookies, no personal data, no cross-site tracking
  • Lightweight — under 1 KB of JavaScript (compared to Google Analytics at 45 KB)
  • GDPR-compliant by design — no consent banner required in most jurisdictions
  • Self-hostable — open source, can run on your own server
  • Paid — $9/month for 10,000 pageviews, which is enough for most small sites
  • The last point — paid — is a feature, not a bug. A tool that charges money does not need to monetize your data. It is a clean business relationship: you pay for analytics, they provide analytics.

    Installing Plausible on Dax Pro

    Step 1: Sign up

    1. Open plausible.io

    2. Click Start free trial (30 days)

    3. Enter your site domain (yourdomain.com, no www, no https://)

    4. Enter your email and password

    5. Plausible creates a dashboard for your site

    Step 2: Get the script

    After creating the site, Plausible shows a script tag:

    <script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
    

    Copy this.

    Step 3: Add the script to base.dax

    Open templates/layouts/base.dax. Find the tag. Add the Plausible script just before it:

    <body>
    

    {% include shared/nav.dax %}

    {% include shared/mobile-drawer.dax %}

    {{ content }}

    {% include shared/footer.dax %}

    <script src="/js/main.js" defer></script>

    <script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>

    </body>

    Replace yourdomain.com with your actual domain.

    Step 4: Rebuild and deploy

    dotnet run -- build
    

    git add templates/layouts/base.dax

    git commit -m "Add Plausible analytics"

    git push

    Step 5: Verify

    1. Wait 1–2 minutes for the build and deploy

    2. Open your site in a browser

    3. Open the Plausible dashboard

    4. Visit a few pages

    5. Refresh the dashboard — you should see your visits

    If no visits appear:

  • Check that the domain in the script matches the domain in the dashboard exactly (yourdomain.com, not www.yourdomain.com)
  • Check the browser console for errors loading the script
  • Try a different browser or an incognito window
  • Why Plausible does not need a cookie banner

    Plausible uses a technique called "cookieless analytics." Instead of storing a cookie on the visitor's browser, Plausible hashes the visitor's IP address, browser, and user agent with a random salt that rotates daily. The resulting hash is used to count unique visitors without storing personal data.

    Because no personal data is stored, Plausible is exempt from most cookie consent requirements under GDPR (specifically, the ePrivacy Directive's cookie rules). In most EU jurisdictions, Plausible does not require a consent banner.

    Note: this exemption is jurisdiction-specific. Some data protection authorities accept it; others are more cautious. If you are in a strict jurisdiction or a highly regulated industry, consult a lawyer. For most small commercial sites, Plausible without consent is acceptable.

    Plausible self-hosted

    Plausible is open source (AGPL v3). You can self-host it on your own server for free, using Docker. This avoids the $9/month fee and gives you full control over your data.

    Requirements: a VPS with at least 2 GB RAM, a domain for the analytics dashboard (analytics.yourdomain.com), and Docker.

    Installation:

    1. Follow the official self-hosting guide at plausible.io/docs/self-hosting

    2. Deploy Plausible on a VPS

    3. Point analytics.yourdomain.com to the VPS

    4. Update the script in base.dax to point to your self-hosted instance:

    <script defer data-domain="yourdomain.com" src="https://analytics.yourdomain.com/js/script.js"></script>
    

    Self-hosting is worth it if you have multiple sites (one instance can host all of them) or if you prefer to control data directly.


    Umami Analytics

    Umami is the open-source alternative to Plausible. It is:

  • Free and open source — MIT license, no paid tier required
  • Self-hostable — runs on any server with Node.js or Docker
  • Privacy-focused — no cookies, no personal data
  • Lightweight — under 2 KB of JavaScript
  • Simple dashboard — fewer metrics than Plausible, but the important ones
  • The main difference: Umami is free to self-host and has no managed hosting tier. You install it on your own server or use a third-party managed Umami provider (there are several).

    Installing Umami (self-hosted)

    Step 1: Provision a server

    Any VPS works. 1 GB RAM is enough for a small site. DigitalOcean, Hetzner, and Vultr all have $5/month plans.

    Step 2: Install Umami via Docker

    On the server:

    git clone https://github.com/umami-software/umami.git
    

    cd umami

    docker compose up -d

    Umami starts on port 3000. Configure a reverse proxy (Nginx) to serve it on analytics.yourdomain.com.

    Step 3: Create an admin account

    Open https://analytics.yourdomain.com in a browser. The first login creates the admin account.

    Step 4: Add your website

    1. In Umami, click Settings → Websites → Add website

    2. Enter your site name and domain

    3. Umami shows a tracking script:

    <script async src="https://analytics.yourdomain.com/script.js" data-website-id="your-website-id"></script>
    

    Step 5: Add the script to base.dax

    <script async src="https://analytics.yourdomain.com/script.js" data-website-id="your-website-id"></script>
    

    Step 6: Rebuild and deploy

    Same as Plausible: rebuild, commit, push.

    Step 7: Verify

    Visit your site, then refresh the Umami dashboard. Your visits appear within a minute.

    Umami hosted

    If you do not want to run a server, there are third-party Umami hosting providers. The official Umami documentation lists them at umami.is/docs. Pricing varies from free (limited) to $5/month (generous).


    Google Analytics

    Google Analytics is the most popular analytics tool. It is also the heaviest, the least privacy-friendly, and the most likely to require a cookie consent banner.

    When to use Google Analytics:

  • You have an existing GA account and need to consolidate data
  • You need Google Ads integration (conversion tracking, remarketing)
  • You need advanced segmentation and custom reporting that Plausible and Umami do not offer
  • You are required to use it by an employer or client
  • When NOT to use Google Analytics:

  • You want privacy-friendly analytics (use Plausible or Umami)
  • You want the smallest possible script (GA is 45 KB, Plausible is 1 KB)
  • You want to avoid cookie consent banners (GA requires them in the EU)
  • You do not actually need GA's advanced features
  • Installing Google Analytics 4

    Step 1: Create a GA4 property

    1. Open analytics.google.com

    2. Sign in with your Google account

    3. Click Admin → Create → Property

    4. Enter your site name, URL, timezone

    5. Choose Web as the platform

    6. Enter your domain

    7. GA4 provides a Measurement ID like G-ABC123DEF4

    Step 2: Add the GA4 script to base.dax

    The GA4 script is larger than Plausible's or Umami's:

    <!-- Google Analytics 4 -->
    

    <script async src="https://www.googletagmanager.com/gtag/js?id=G-ABC123DEF4"></script>

    <script>

    window.dataLayer = window.dataLayer || [];

    function gtag(){dataLayer.push(arguments);}

    gtag('js', new Date());

    gtag('config', 'G-ABC123DEF4');

    </script>

    Place it in (GA4 documentation recommends the head, unlike Plausible and Umami which go at the end of ).

    Step 3: Add a cookie consent banner

    In the EU and UK, GA4 requires user consent before it loads. You must implement a consent banner.

    Option 1: Use a consent management platform (CMP). Tools like Cookiebot, Termly, or Osano handle the banner, consent storage, and GA4 integration. They cost $10–$50/month.

    Option 2: Build your own banner. A simple HTML + CSS + JavaScript banner that asks for consent, stores the choice in localStorage, and conditionally loads GA4. This is complex to get right — consent management is a legal field, not a technical one.

    Option 3: Do not use GA4 in the EU. If you are not required to use GA4, the simplest path is to use Plausible or Umami, which do not require a consent banner.

    For most Dax Pro users, option 3 is the right answer.

    Step 4: Rebuild and deploy

    Same as Plausible: rebuild, commit, push.

    Step 5: Verify

    1. Visit your site

    2. In GA4, click Reports → Realtime

    3. Confirm your visit appears within 30 seconds

    Note: GA4 has a data processing delay. Some reports (sessions, users, pageviews) take 24–48 hours to populate. Realtime shows only recent visits.


    Where to Place the Script

    Placement affects performance and reliability.

    Plausible, Umami

    Place at the end of , before :

    <body>
    

    <!-- page content -->

    <script src="/js/main.js" defer></script>

    <script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>

    </body>

    Why: the script uses defer, which loads it in parallel with the page without blocking rendering. Placing it at the end of means the page content is parsed and rendered before the script loads.

    Google Analytics 4

    Place in :

    <head>
    

    <!-- meta tags -->

    <script async src="https://www.googletagmanager.com/gtag/js?id=G-ABC123DEF4"></script>

    <script>

    window.dataLayer = window.dataLayer || [];

    function gtag(){dataLayer.push(arguments);}

    gtag('js', new Date());

    gtag('config', 'G-ABC123DEF4');

    </script>

    </head>

    Why: GA4 documentation recommends head placement. The script uses async, which loads it without blocking rendering.

    Avoid placing analytics in top

    Do not place analytics scripts at the top of . They block rendering and delay the page's first paint. Even with defer or async, the browser downloads the script as part of the critical path.

    Always use defer or async. A synchronous analytics script blocks rendering and drops Lighthouse scores.


    Custom Events

    Analytics tools can track specific user actions: a button click, a form submission, a scroll to a specific section. This tells you whether visitors engage, not just whether they arrive.

    Plausible custom events

    Syntax in HTML:

    <button onclick="plausible('CTA Click')">Buy Now</button>
    

    Or via JavaScript:

    plausible('CTA Click', { props: { section: 'pricing' } });
    

    Viewing events in Plausible: the dashboard shows custom events separately from pageviews.

    Common events:

  • CTA Click — a call-to-action button was clicked
  • Form Submit — a contact form was submitted
  • Signup — a signup link was clicked
  • Download — a file download was initiated
  • External Link — a link to another domain was clicked
  • Umami custom events

    Syntax in HTML:

    <button data-umami-event="CTA Click">Buy Now</button>
    

    Or via JavaScript:

    umami.track('CTA Click', { section: 'pricing' });
    

    Viewing events in Umami: events appear in the dashboard under "Events."

    GA4 custom events

    Syntax in JavaScript:

    gtag('event', 'cta_click', {
    

    'section': 'pricing',

    'value': 199

    });

    Viewing events in GA4: custom events appear in the "Events" report and can be configured as conversions.

    Where to add event tracking in Dax Pro

    The contact form in templates/partials/contact/box.dax is a natural place for event tracking. Add a plausible('Form Submit') call when the form is submitted successfully. Similarly, the pricing buttons are CTAs — add events when they are clicked.

    But do not over-instrument. Every event you add is another thing to maintain. Choose three to five events that measure your most important conversions, and track only those.


    Privacy Compliance

    Analytics involves personal data. Depending on where your visitors are, you may be required to comply with:

  • GDPR (EU) — requires lawful basis for processing personal data, disclosure, and often explicit consent
  • CCPA (California) — requires disclosure, opt-out, and no sale of personal data
  • LGPD (Brazil) — similar to GDPR
  • PIPEDA (Canada) — similar to GDPR
  • Which tools are GDPR-safe

    Tool GDPR compliant without consent?
    Plausible Usually yes — cookieless, no personal data
    Umami Usually yes — cookieless, no personal data
    Google Analytics No — requires consent + data processing agreement
    Facebook Pixel No — requires consent + DPA
    Any tool that sets cookies No — requires consent

    "Usually yes" means the tool is designed to avoid personal data processing, and most EU data protection authorities accept this. But the legal interpretation varies by jurisdiction, and the landscape changes.

    If you are in the EU/UK and want zero legal risk: use Plausible or Umami, add a short privacy notice explaining that analytics is used without cookies, and do not display a consent banner.

    If you use Google Analytics in the EU: you must implement a consent banner, obtain explicit opt-in before GA4 loads, and sign a Data Processing Agreement with Google. This is not optional. Fines for non-compliance can be substantial.

    Adding a privacy notice

    Update content/privacy.md to explain your analytics setup. Include:

    1. What tool you use — "This site uses Plausible Analytics"

    2. What data it collects — "Plausible records pageviews, referrer, and browser type. It does not use cookies or collect personal data."

    3. Where data is stored — "Data is stored in the EU" (for Plausible) or "Data is stored on our own servers" (for self-hosted)

    4. How visitors can opt out — "Visitors can opt out by using browser extensions like Plausible's official opt-out" or "Visitors can contact us to request data deletion"

    Example privacy note for Plausible:

    ## Analytics
    
    

    This site uses Plausible Analytics, a privacy-focused analytics tool. Plausible does not use cookies, does not collect personal data, and does not track visitors across sites. It records pageviews, referrer, browser type, and country. All data is aggregated and stored in the EU.

    Plausible does not require a cookie consent banner. Visitors who wish to opt out can use Plausible's opt-out extension.

    This satisfies most GDPR requirements for analytics without requiring a consent banner.


    Verifying Analytics Works

    After installing, verify:

    Plausible

    1. Open your site in a browser

    2. Visit 2–3 pages

    3. Open the Plausible dashboard

    4. Click Realtime in the sidebar

    5. Your visit appears within 30 seconds

    6. Check the Top Pages report after a day — the pages you visited appear

    Umami

    1. Open your site

    2. Visit 2–3 pages

    3. Open the Umami dashboard

    4. Click Realtime in the top menu

    5. Your visit appears within a minute

    Google Analytics 4

    1. Open your site

    2. Visit 2–3 pages

    3. Open GA4

    4. Click Reports → Realtime

    5. Your visit appears within 30 seconds

    Lighthouse

    After adding analytics, run Lighthouse:

    1. Open Chrome DevTools (F12)

    2. Click Lighthouse tab

    3. Click Analyze page load

    4. Check the Performance score

    Plausible and Umami: Lighthouse stays at 95–100. The scripts are tiny and deferred.

    Google Analytics 4: Lighthouse drops to 90–95. The GA4 script is 45 KB and adds two network requests.

    If Lighthouse drops below 90, check whether the analytics script is async or defer. A synchronous script blocks rendering. Also check whether the script is placed in (for GA4) or at the end of (for Plausible/Umami).


    Common Analytics Mistakes

    Mistake 1: Installing analytics before launch.

    Analytics records data from the moment it is live. If you install it before finalizing the site, you collect "data" from your own testing. Install after launch.

    Mistake 2: Using a different domain in the script than in the dashboard.

    The script has data-domain="yourdomain.com". If the dashboard is set up for www.yourdomain.com, the data does not flow. Match exactly.

    Mistake 3: Not excluding your own visits.

    Your own visits count as "visitors." Plausible and Umami have options to exclude your IP or add a self-exclusion cookie. Configure this after installing, so your data is not polluted by testing.

    Mistake 4: Installing a tool that requires consent without a banner.

    If you install Google Analytics in the EU without a consent banner, you are non-compliant. Use Plausible/Umami or implement a consent banner.

    Mistake 5: Placing the script synchronously.

    A script without async or defer blocks rendering. The page's first paint is delayed. Always use async or defer.

    Mistake 6: Placing Plausible/Umami in .

    They should be at the end of . Placing them in delays rendering.

    Mistake 7: Placing GA4 at the end of .

    GA4 should be in (with async). Placing it at the bottom means it may not fire on fast navigation.

    Mistake 8: Not testing after adding the script.

    A typo in the domain or script URL means no data. Always verify with Realtime after installing.

    Mistake 9: Overloading the site with multiple analytics tools.

    Running Plausible + Umami + GA4 at the same time triples the script weight and sends data to three services. Choose one.

    Mistake 10: Not disclosing analytics in the privacy policy.

    If you collect any data (even cookieless), most privacy regulations require disclosure. Update content/privacy.md.

    Mistake 11: Using analytics to track individual users.

    Analytics is for aggregate patterns, not individual surveillance. Do not try to identify specific visitors, even with tools that allow it. It is a privacy violation and, in many jurisdictions, illegal.

    Mistake 12: Ignoring the data.

    Installing analytics and never looking at the dashboard is worse than not installing it. Check the dashboard weekly. Use the data to inform content decisions. If you are not going to look at it, do not install it.


    What You Have Now

    After this chapter, you can:

  • ✅ Decide whether analytics is worth the overhead for your site
  • ✅ Choose between Plausible, Umami, and Google Analytics
  • ✅ Install Plausible on Dax Pro without breaking Lighthouse
  • ✅ Self-host Umami if you prefer full control
  • ✅ Install Google Analytics responsibly with consent management
  • ✅ Place analytics scripts for optimal performance
  • ✅ Track custom events for important conversions
  • ✅ Understand GDPR compliance and privacy disclosures
  • ✅ Verify analytics is working
  • ✅ Fix the twelve most common analytics mistakes
Analytics is a tool for understanding your audience. It is optional. If you install it, install it responsibly — with privacy in mind, with performance in mind, and with the intent to actually use the data.

The next chapter is Decap CMS — the full editor reference: login, media library, editorial workflow, publishing, history, and how to manage editors and their access.

→ Continue to Decap CMS