Tracking script

A lightweight, privacy-focused tracking script under 1KB.

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:

  1. A daily-rotating salt is combined with the visitor's IP address and user agent
  2. This is hashed to create a temporary identifier
  3. The identifier changes each day, preventing long-term tracking
  4. The original IP is never stored

This allows accurate unique visitor counts while maintaining privacy.

Performance

  • Script size: under 1KB (gzipped)
  • Loads asynchronously with defer
  • No impact on page load speed or Core Web Vitals
  • Uses sendBeacon for reliable tracking without blocking