Tracking script
A lightweight, privacy-focused tracking script.
Basic usage
<script defer data-site-id="YOUR_SITE_ID" src="https://glyphex.io/tracker.js" ></script>
What it tracks
The tracking script automatically collects:
- Page views - Every page your visitors view
- Referrer - Where visitors came from (Google, social media, etc.)
- UTM parameters - Campaign tracking (utm_source, utm_medium, etc.)
- Device type - Desktop, mobile, or tablet
- Browser - Chrome, Firefox, Safari, etc.
- Operating system - Windows, macOS, iOS, Android, etc.
- Country and city - Approximate location from IP (IP not stored)
- Outbound link clicks - Links to external websites
- File downloads - Downloads of PDFs, ZIPs, and other files
- Scroll depth - How far visitors scroll on each page
- Time on page - Duration spent on each page
What it does NOT track
- Personal information (names, emails, etc.)
- IP addresses (used only for geo lookup, then discarded)
- Cookies or persistent identifiers
- Cross-site tracking
- Fingerprinting that could identify individuals
Configuration options
Disable tracking
Users can opt out by setting a localStorage flag:
// Opt out of tracking
localStorage.setItem('glyphex_ignore', 'true');
// Opt back in
localStorage.removeItem('glyphex_ignore');Track only in production
The script automatically ignores localhost and file:// URLs. For conditional loading:
{process.env.NODE_ENV === 'production' && (
<Script
defer
data-site-id="YOUR_SITE_ID"
src="https://glyphex.io/tracker.js"
/>
)}Automatic tracking
Outbound links
Clicks on links to external domains are automatically tracked. You'll see these in the Behavior tab under "Outbound links".
File downloads
Downloads of common file types are tracked automatically:
pdf, zip, rar, 7z, doc, docx, xls, xlsx, ppt, pptx, csv, mp3, mp4, exe, dmg, apk
How visitor identification works
Glyphex uses a privacy-safe approach to identify unique visitors without cookies:
- A daily-rotating salt is combined with the visitor's IP address and user agent
- This is hashed to create a temporary identifier
- The identifier changes each day, preventing long-term tracking
- The original IP is never stored
This allows accurate unique visitor counts while maintaining privacy.
Modules and script size
The tracker is a small core (pageviews, SPA navigation, custom events, engagement, opt-out) plus optional modules. The per-site tag /t/YOUR_SITE_ID.js ships the core and only the modules you enable in Settings, Tracking code, Features. A missing setting means the module that was always on stays on, so existing sites do not change.
- Outbound links, file downloads, rage clicks: on by default, switch off in Settings
- Core Web Vitals, JavaScript errors: opt-in
- Broken URLs (404): built into the core, no extra size
- The script tag with
/tracker.jsloads the full build with every module
beforeSend hook
Inspect, change, or drop any hit before it is sent. Set data-before-send on the script tag to the name of a global function, or beforeSend in window.__glyphex. Return a falsy value to drop the hit, or an object to replace the payload.
<script defer data-site-id="YOUR_SITE_ID" data-before-send="myFilter" src="https://glyphex.io/tracker.js"></script>
window.myFilter = (type, payload) => {
if (payload.pathname.startsWith("/admin")) return false; // drop
return payload; // or return a changed copy
};Declarative events
Add data-glyphex-event to any element to track a click without writing JavaScript. Extra data-glyphex-event-* attributes become event properties.
<button data-glyphex-event="Signup" data-glyphex-event-plan="pro">Sign up</button>
Performance
- Script size: core about 1.5 KB gzipped (under 2 KB). A new site's default per-site script is about 1.8 KB, the full /tracker.js about 2.8 KB.
- Loads asynchronously with
defer - Minimal impact on page load speed or Core Web Vitals
- Uses
sendBeaconfor reliable tracking without blocking