# Cloudflare Worker analytics

> Live analytics for any site behind Cloudflare, with no change to the site: a Worker sends crawler visits, 404s and response times and adds the script to every page.

Source: https://mettr.app/integrations/cloudflare

## A Worker in front, nothing changed behind

A static site, a site builder, a CMS you would rather not touch: if its domain is proxied by Cloudflare, a Worker on its routes passes each request to the site as it was, and tells mettr what only a server sees.

```ts
// src/index.ts
export { default } from '@mettr/cloudflare';
```

```bash
npx wrangler secret put METTR_SECRET_KEY
npx wrangler secret put METTR_PUBLIC_KEY
npx wrangler deploy
```

## What it sends

- **Crawler visits**, with the status your site answered: Googlebot, Bingbot, GPTBot, ClaudeBot and the rest seldom run scripts, so a script in the page never sees them.
- **404s** of people, and **response times** of your pages.
- **Page views and who is online**: the Worker adds the [browser script](/docs/browser-script)'s tag to every HTML page and serves the script from `/_live` on your own domain, so ad blockers mostly let it through.

Images, scripts and fonts send nothing, and paths you list send nothing either.

## Who your visitor is

Cloudflare gives the Worker the visitor's address; mettr places the visitor and drops the address. Tell it who is signed in, or who is staff, from a cookie or a header, in a few lines of your own Worker.

## Open source

`@mettr/cloudflare` is MIT licensed, on [GitHub](https://github.com/mettrhq/mettr-js) and [npm](https://www.npmjs.com/package/@mettr/cloudflare). [The full guide](/docs/cloudflare).
