Skip to content
 
 

Repository files navigation

Iris Analytics

Iris Analytics

A lightweight, open-source website analytics dashboard powered by Cloudflare Pages + Analytics Engine

Demo · Deployment · Deployment Guide (Chinese)

简体中文

Introduction

Iris Analytics is a website analytics tool rebuilt from HanAnalytics, offering a clearer and more intuitive data overview with an improved user experience.

No database required — fully powered by the Cloudflare ecosystem:

  • Pages — Hosts the frontend and API (Pages Functions)
  • Workers Analytics Engine — Time-series database for storing analytics data

Prerequisites

  • Log in to Cloudflare
  • Cloudflare Account ID (available on the Workers & Pages page)
  • Cloudflare API Token with Account Analytics Read permission
  • Create a dataset in Analytics Engine with binding name AnalyticsBinding and dataset name AnalyticsDataset

Deployment

  1. Fork this repository or use it as a template
  2. Create a Cloudflare Pages project, select your forked repo, choose Vue framework, fill in the environment variables, and deploy
  3. In your Pages project Settings > Bindings, add an Analytics Engine binding with variable name AnalyticsBinding and dataset AnalyticsDataset, then redeploy
  4. Visit https://your-project.pages.dev to access the analytics dashboard
  5. Go to Settings > Integration to get the tracking script and add it to your site
  6. Return to the dashboard and wait for visit data.

Environment Variables

Variable Description Required
CLOUDFLARE_ACCOUNT_ID Cloudflare Account ID Yes
CLOUDFLARE_API_TOKEN Cloudflare API Token (Account Analytics Read permission) Yes
CLOUDFLARE_WEBSITE_PWD Dashboard access password (leave empty for no password) No
CLOUDFLARE_WEBSITE_WHITELIST Analytics whitelist — format: WebsiteID | domain, newline- or comma-separated No

Analytics Engine Binding

# Binding name
AnalyticsBinding
# Dataset name
AnalyticsDataset

Tracking Script

Insert the following code at the bottom of your website to integrate analytics:

<script defer src="https://your-project.pages.dev/tracker.min.js" data-website-id="your-unique-site-id"></script>

Whitelist

By default, the analytics API is public — any site can send data to the dataset. The whitelist provides two-way verification of both the site ID and domain to prevent data pollution.

# Recommended: comma-separated (single line) — avoids the Cloudflare env var UI stripping newlines
CLOUDFLARE_WEBSITE_WHITELIST = website-id | domain.com, iris | iris.exi.software

Newline-separated rules are also supported (one rule per line, or a mixed format with each line ending in a comma). However, since Cloudflare's page may change and newlines could be lost, making the config hard to edit later, this configuration style is not recommended. If you do use it, it's recommended to end each rule with a comma.

# Format: WebsiteID | domain, newline-separated
CLOUDFLARE_WEBSITE_WHITELIST =
website-id | domain.com
iris | iris.exi.software
...

# Format: WebsiteID | domain, mixed newline-separated with trailing commas
CLOUDFLARE_WEBSITE_WHITELIST =
website-id | domain.com,
iris | iris.exi.software,
...

The whitelist validates both the unique site ID and domain, ensuring only authorized websites can report data.

Authentication

Set the CLOUDFLARE_WEBSITE_PWD environment variable to require a password for dashboard access. The login session lasts for 7 days and auto-renews on active visits.

# Set a password to protect the dashboard (no password by default)
CLOUDFLARE_WEBSITE_PWD = your_password

Gratitude

License

The project is licensed under the MIT.

About

A lightweight, open-source website analytics dashboard powered by Cloudflare Pages + Analytics Engine

Topics

Resources

Stars

16 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages