Skip to content

Installation

The Zori tracking script is a lightweight analytics tracker with comprehensive browser fingerprinting and automatic event tracking.

Section titled “Recommended: Async Loading with Event Queue”

For optimal performance, initialize the queue before loading the script:

<!-- Initialize queue first -->
<script>
window.ZoriHQ = window.ZoriHQ || [];
</script>
<!-- Load script asynchronously -->
<script async src="https://cdn.zorihq.com/script.min.js"
data-key="your-publishable-key"></script>
<!-- Track events immediately (even before script loads) -->
<script>
window.ZoriHQ.push(['track', 'page_view']);
window.ZoriHQ.push(['identify', {
app_id: 'user_123',
}]);
</script>

For simpler setups, just add the script tag:

<script src="https://cdn.zorihq.com/script.min.js"
data-key="your-publishable-key"></script>
URLDescription
https://cdn.zorihq.com/script.min.jsLatest stable version
https://cdn.zorihq.com/v1.0.6/script.min.jsSpecific version (immutable)
https://cdn.zorihq.com/latest/script.min.jsAlways latest

We recommend pinning to a specific version in production for stability.

Customize behavior with data attributes:

<script
src="https://cdn.zorihq.com/script.min.js"
data-key="your-publishable-key"
data-base-url="https://your-custom-endpoint.com/ingest"
data-comeback-threshold="30000"
data-track-quick-switches="false">
</script>
AttributeDefaultDescription
data-keyRequiredYour publishable key from the dashboard
data-base-urlhttps://ingestion.zorihq.com/ingestCustom ingestion endpoint (for self-hosted)
data-comeback-threshold30000Minimum hidden duration (ms) to trigger user_comeback event
data-track-quick-switchesfalseTrack all visibility changes, not just significant ones

When self-hosting Zori, point the script to your ingestion server:

<script
src="https://cdn.zorihq.com/script.min.js"
data-key="your-publishable-key"
data-base-url="https://your-domain.com:1324/ingest">
</script>

Or host the script yourself:

<script
src="https://your-domain.com/zori-script.min.js"
data-key="your-publishable-key"
data-base-url="https://your-domain.com:1324/ingest">
</script>

The tracking script includes:

  • Advanced Browser Fingerprinting - Canvas, WebGL, Audio Context, hardware
  • Automatic Event Tracking - Page views, clicks, visibility, unloads
  • Persistent Visitor ID - Cookie-based, 2-year expiry
  • UTM Parameter Capture - Automatic campaign attribution
  • Session Tracking - 30-minute timeout, automatic management
  • Event Queue - Track events before script loads
  • Heatmap Ready - Click positions normalized by screen size
  • GDPR Compliant - Consent management, DNT support, opt-out
  • Minified: ~6.6KB
  • Gzipped: ~2.5KB

Works on all modern browsers:

  • Chrome 60+
  • Firefox 60+
  • Safari 12+
  • Edge 79+
  • Mobile browsers (iOS Safari, Chrome for Android)