# Cloudflare Edge Analytics Worker Setup

> Canonical source: [Cloudflare Edge Analytics Worker Setup](https://www.answer.cloud/pages/cloudflare-edge-analytics-worker-setup-hosted/)

Use the current Worker integration and matching secret bindings to measure requests on an existing website.

Follow the [current Cloudflare Worker guide](https://www.answer.cloud/docs/cloudflare-worker-agent-analytics-hosted/) for the complete script, `RAILS_URL` and `SHARED_SECRET` bindings, proxied website routes, and verification.

The Worker forwards the request to the origin and schedules analytics with `ctx.waitUntil()`. Background analytics is best effort; this is not a promise of zero latency or delivery for every request.

A Worker route must match the website hostname, and its DNS record must be proxied. A workers.dev URL alone does not observe your website traffic.

Keep secret names consistent with the script. The current integration uses `SHARED_SECRET`, not a mixture of `LOG_SECRET` and `env.log_secret`. Store the value as a Cloudflare Secret and keep it out of public source and screenshots.

Verify normal website responses and the first observed event using the linked guide. Request counts are distinct from human referrals and AI citations.