yestool/analytics_with_cloudflare
yestool/analytics_with_cloudflare has 147 GitHub stars and 39 forks. GitHot measured 0 stars in 24 hours and +1 in 7 days. Last checked 2026-11-09 12:23 UTC. Last push 2024-10-23.
a simple web analytics use Cloudflare workers + D1 + Huno. 👉 https://webviso.yestool.org
Measured star growth
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original简体中文 · English
Web Visitor Analytics Service Based on Cloudflare + Huno + D1
Deployment Steps
Install Dependencies
npm install -g wrangler
npm install hono
Login
Redirect to the Cloudflare web authorization page.
npx wrangler login
Create D1 Database: [web_analytics]
The database name should be
web_analytics, consistent with the name inpackage.json.
npx wrangler d1 create web_analytics
After successful creation, it will display:
✅ Successfully created DB web_analytics
[[d1_databases]]
binding = "DB" # available in your Worker on env.DB
database_name = "web_analytics"
database_id = "<unique-ID-for-your-database>"
Configure Worker and Bind D1 Database
Write the unique-ID-for-your-database returned from the previous step into wrangler.toml.
name = "analytics_with_cloudflare"
main = "src/index.ts"
compatibility_date = "2024-06-14"
[[d1_databases]]
binding = "DB" # available in your Worker on env.DB
database_name = "web_analytics"
database_id = "<unique-ID-for-your-database>"
Initialize the D1 Database Schema
npm run initSql
Deploy
npm run deploy
After successful deployment, it will display:
> [email protected] deploy
> wrangler deploy
Proxy environment variables detected. We'll use your proxy for fetch requests.
⛅️ wrangler 3.18.0
-------------------
Your worker has access to the following bindings:
- D1 Databases:
- DB: web_analytics (<unique-ID-for-your-database>)
Total Upload: 50.28 KiB / gzip: 12.23 KiB
Uploaded analytics_with_cloudflare (1.29 sec)
Published analytics_with_cloudflare (4.03 sec)
https://analytics_with_cloudflare.xxxxx.workers.dev
Current Deployment ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
How to Use
data-base-urldefault value:https://webviso.yestool.orgdata-page-pv-iddefault value:page_pvdata-page-uv-iddefault value:page_uv
1. Include the Script
Add the following <script>...</script> segment before the closing </body> tag in your HTML.
- Using the online JS file:
With the defer attribute, the browser will execute these scripts after all content is loaded.
<script defer src="//webviso.yestool.org/js/index.min.js"></script>
- Using a local JS file:
<script src="/front/dist/index.min.js"></script>
- If you have deployed your backend, use your service address to send requests to your own service.
Change
your-urlto your worker address, likehttps://analytics_with_cloudflare.workers.dev, and ensure there is no trailing/.
<script defer src="//webviso.yestool.org/js/index.min.js" data-base-url="your-url"></script>
2. Display Data
- Add tags with the ID
page_pvorpage_uvto showPage Views (pv)orUnique Visitors (uv)respectively.
Page Views on this page:<span id="page_pv"></span>
Unique Visitors on this page:<span id="page_uv"></span>
- You can edit the script parameters to adjust the tag IDs.
<script defer src="//webviso.yestool.org/js/index.min.js" data-base-url="your-url" data-page-pv-id="page_pv" data-page-uv-id="page_uv"></script>
Explore related projects
Asabeneh/30-Days-Of-Python
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,423 starsgrafana/grafana
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
77,790 starsredis/redis
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.
77,309 starsapache/superset
Apache Superset is a Data Visualization and Data Exploration Platform
75,455 stars