Guide
Setup analytics
A single script tag gives you pageviews, scroll depth, engagement time, and session tracking. No configuration required.
Install the script
Drop this tag into the <head> of every page you want tracked. Put it as high as possible so it can deliver experiment variants before your content paints.
index.htmlhtml
<!-- Grademypage Analytics -->
<script async
src="https://www.grademypage.com/api/analytics/script.js?projectId=<YOUR_PROJECT_KEY>">
</script>yourdomain.com/index.html
<!DOCTYPE html>
<html>
<head>
<title>Your Landing Page</title>
<script async src=".../script.js?projectId=..."></script>
</head>
<body>...</body>
</html>
Place in <head>, not at the end of <body>
Experiments apply DOM changes before paint by running the script early. Putting it at the end of <body> can cause a brief flash of the control variant.What gets auto-tracked
Once the script loads, Grademypage automatically captures the events most teams need. No extra code required.
| Event | When it fires |
|---|---|
| pageview | Every page load & client-side route change. |
| scroll | At 25%, 50%, 75%, and 100% scroll depth. |
| engagement | Active time on page, reported on visibility change. |
| session | Anonymous visitor & session IDs (30-minute timeout). |
| referrer & UTMs | Captured from the landing URL automatically. |
Privacy-first by default
The script respects Do Not Track, uses first-party cookies only, and never collects PII.Configuration options
The tag works without any configuration, but you can override a handful of defaults by setting globals before the script loads.
<script>
// Optional: override the collector base URL (self-hosted / staging).
window.GMP_BASE_URL = "https://analytics.yourdomain.com";
</script>
<script async src="https://www.grademypage.com/api/analytics/script.js?projectId=<YOUR_PROJECT_KEY>"></script>| Global | Default | Purpose |
|---|---|---|
| window.GMP_BASE_URL | grademypage.com | Override collector host. |
| navigator.doNotTrack | respected | Script no-ops when DNT is enabled. |
Verify it's working
Load your site in a new tab, then open your dashboard. You should see the visit appear in the Live panel within a few seconds.
Not seeing events?
Open DevTools → Network → filter for track. You should see a POST /api/analytics/track returning 200. If the request is blocked, check that your Content Security Policy allows grademypage.com.