Analytics
Diggama includes a built-in, privacy-friendly analytics engine. It tracks visitors, sessions, and pageviews without cookies and without third-party services.
Setup
1. Allow your domains
From the Diggama dashboard, go to Project settings > Domains and add the domains that will send analytics data.
Domains should be added without protocol or path. For example,
example.comwill allowexample.com/blogbut notwww.example.com/blog.
2. Generate a tracking token
Go to Project settings > Tokens and create a new token. Leave the permissions empty — this token is only used to identify your project for the tracking script.
Copy the token and keep it safe.
3. Add the tracking script
Add the following script tag to every page of your site, ideally in your layout component or <head>:
<script src="https://api.diggama.com/v1/here.js" x-diggama-token="{token}" async></script>Replace {token} with your tracking token.
Framework examples:
Astro (src/layouts/Base.astro):
<head>
<script src="https://api.diggama.com/v1/here.js"
x-diggama-token={import.meta.env.PUBLIC_DIGGAMA_TOKEN}
async></script>
</head>Next.js (app/layout.tsx):
<Script
src="https://api.diggama.com/v1/here.js"
data-x-diggama-token={process.env.NEXT_PUBLIC_DIGGAMA_TOKEN}
strategy="afterInteractive"
/>What is tracked
| Metric | Description |
|---|---|
| Visitors | Unique visitors identified by a fingerprint (no cookies) |
| Sessions | A group of pageviews from the same visitor |
| Pageviews | Each page visited |
| Referrers | Where visitors came from |
| Device, browser, country | Aggregated demographics |
| Session duration | Time between first and last pageview |
| Bounce rate | Percentage of sessions with a single pageview |
Dashboard
Analytics data is available in the Diggama dashboard under the Analytics tab of your project. It shows real-time live users, trends, top pages, referrers, and device breakdowns.
Analytics API
For programmatic access to analytics data (e.g. building custom dashboards), see the Analytics API reference.