Back to Documentation

Getting Started

Get Once Analytics running on your website in under 5 minutes.

Requirements

  • A Cloudflare account (free tier works)
  • A domain connected to Cloudflare

Tip: Cloudflare free tier includes 100,000 Worker requests/day and 5GB D1 storage. This covers most small-to-medium sites comfortably.

Installation

After purchase, the web installer guides you through these steps:

  1. Create API Token — Click the provided link to create a pre-configured Cloudflare API token with exactly the permissions needed
  2. Choose Authentication — Protect your dashboard with a PIN code (recommended) or Cloudflare Access (Zero Trust)
  3. Select Domain — Pick which domain to use from your Cloudflare account
  4. Choose Subdomain — Enter a subdomain like stats or analytics (final URL: stats.yoursite.com)
  5. Automatic Setup — The installer creates your Worker, database, DNS record, and routing

The entire process takes about 2 minutes.

Note: Your API token is only used during installation and is never stored. You can delete it from Cloudflare after installation completes. See API Token Usage for details.

Adding the tracking script

After installation, add this script to your website's <head>:

html
<script defer src="https://stats.yoursite.com/script.js"></script>

Replace stats.yoursite.com with your actual analytics subdomain.

For WordPress: Add to your theme's header.php or use a plugin like "Insert Headers and Footers".

For Next.js/React: Add to your _document.js or root layout.

For static sites: Add to every HTML page's <head> section.

Verify installation

  1. Visit your website in a browser
  2. Open your analytics dashboard at https://stats.yoursite.com/dashboard
  3. You should see your pageview appear within seconds

Next steps


Need help? Email hello@onceanalytics.com