Zone / Zone / Read — Locate your Cloudflare zone by domain name
Zone / Workers Routes / Edit — Attach the script to your domain route
Step 2: Paste the token and deploy
We’ll take it from here — the rest is automatic.
Auto-deploy is only available inside the Promptwatch app. Open Crawler Logs → Settings, select Cloudflare Workers, switch to the Auto Deploy tab, paste your Cloudflare API token, and click Deploy Worker.
Step 1: Create an API Key
Create an API key in Promptwatch. Go to Settings → API Keys in your Promptwatch dashboard.
Step 2: Create an Application
Create a new application in your Cloudflare account:
Promptwatch identifies AI crawlers automatically and only stores AI crawler visits, all other traffic is discarded. You can safely send all your server logs without worrying about non-crawler data being retained.If you prefer to only forward AI crawler traffic, you can use the user agents listed below to pre-filter on your side. Keep in mind that you’ll need to maintain this list yourself as new crawlers emerge.
OpenAI (4)
Name
User Agent
Full User Agent
Description
GPT Bot
GPTBot
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.3; +https://openai.com/gptbot
Used to crawl content for training OpenAI’s generative AI foundation models.
SearchBot
OAI-SearchBot
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36; compatible; OAI-SearchBot/1.3; +https://openai.com/searchbot
Used by ChatGPT search to surface websites in search results.
ChatGPT Citations
ChatGPT-User
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot
Used for user actions in ChatGPT when visiting web pages.
Ads Bot
OAI-AdsBot
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OAI-AdsBot/1.0; +https://openai.com/adsbot
Used to validate the safety of web pages submitted as ads on ChatGPT.
Anthropic (4)
Name
User Agent
Full User Agent
Description
Claude Bot
ClaudeBot
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Used to crawl content for training Anthropic’s generative AI models.
Claude Citations
Claude-User
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; Claude-User/1.0; +claudebot@anthropic.com)
When individuals ask questions to Claude or use Claude Code, it may access websites using a Claude-User agent.
Claude Search Bot
Claude-SearchBot
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Claude-SearchBot/1.0; +searchbot@anthropic.com)
Navigates the web to improve search result quality for users.
Fetches a page live when a user, or an application built on the Exa API, asks for its current content.
Step 4: Environment Variables
In your Worker settings, add a secret for your API key:
Open the Settings tab for your Worker
Under Variables and secrets, click Add
Select Secret
Set the name to ANALYTICS_KEY
Set the value to the API key you created in Step 1
Step 5: Deploy to a Route
Deploy your Worker to a route:
Navigate to Domains
Select the domain you’re setting up
In the left-hand navigation, click Worker Routes
Add a new route: yourdomain.com/*
Select your Worker from the dropdown
Save and deploy
The Worker will intercept all requests to your domain. It transparently passes through all traffic while logging HTML page views to Promptwatch.
Step 6: Verify Cloudflare Proxy is Enabled
Verify your domain’s DNS records have the Cloudflare proxy enabled (orange cloud icon). Workers Routes only intercept traffic that flows through the Cloudflare network. If the proxy is off (gray cloud / “DNS only”), requests go directly to your origin and bypass the Worker entirely.Go to your Cloudflare dashboard → DNS → Records and make sure the Proxy status shows the orange cloud (“Proxied”) for your domain’s A/AAAA/CNAME records.
Step 7: Finish
Once deployed, your Worker will automatically send crawler logs to Promptwatch.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/schema.json","name":"Promptwatch API Documentation","colors":{"primary":"#155EEF","light":"#6196FF","dark":"#0D4FD1"},"logo":{"light":"https://mintcdn.com/promptwatch/FBwQmv0BrcUvup55/logo/text-logo-light.svg?fit=max\u0026auto=format\u0026n=FBwQmv0BrcUvup55\u0026q=85\u0026s=6ff2b45e7fb7b0343f0a0cdc24a4df3e","dark":"https://mintcdn.com/promptwatch/FBwQmv0BrcUvup55/logo/text-logo-dark.svg?fit=max\u0026auto=format\u0026n=FBwQmv0BrcUvup55\u0026q=85\u0026s=a40935830f28dd78680df7c44500515c","href":"https://promptwatch.com"},"favicon":"https://mintcdn.com/promptwatch/dWspv4M8e4BF4QMY/favicon.svg?fit=max\u0026auto=format\u0026n=dWspv4M8e4BF4QMY\u0026q=85\u0026s=d972b8a82fc6037e544f41fb552f57b0","api":{},"navbar":{"links":[{"href":"/academy","label":"Promptwatch Academy"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.promptwatch.com/"}},"footer":{"socials":{"x":"https://x.com/promptwatch","github":"https://github.com/promptwatch","linkedin":"https://linkedin.com/company/promptwatch"},"links":[{"header":"Resources","items":[{"label":"Academy","href":"/academy"},{"label":"Website","href":"https://promptwatch.com"},{"label":"Blog","href":"https://promptwatch.com/blog"}]},{"header":"Developer Tools","items":[{"label":"Postman Collection","href":"/docs/public/assets/promptwatch-api.postman_collection.json"},{"label":"API v2 Reference","href":"/docs/introduction"},{"label":"API v1 Reference","href":"/docs/v1/introduction"}]},{"header":"Support","items":[{"label":"Contact Support","href":"mailto:support@promptwatch.com"},{"label":"Getting Started","href":"https://app.promptwatch.com/signin"},{"label":"Rate Limits","href":"/docs/rate-limits"}]}]},"seo":{"indexing":"all"},"icons":{"library":"lucide"},"contextual":{"options":["copy","view","chatgpt","claude","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"promptwatch","hasAudioNarration":false,"actualSubdomain":"promptwatch","customDomains":["promptwatch.com"],"gitSource":{"type":"github","owner":"promptwatch-com","repo":"promptwatch","deployBranch":"main","contentDirectory":"apps/server/src/api/docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b045ba144961eaca6de1261","clientVersion":"0.0.4271","searchFilterCounts":[{"language":"default","tag":"API Reference","count":175},{"language":"default","tag":"API Documentation","count":151},{"language":"default","tag":"Promptwatch Academy","count":112},{"language":"default","tag":"Content Agent","count":21},{"language":"default","tag":"Analytics","count":19},{"language":"default","tag":"Crawler log setup","count":17},{"language":"default","tag":"Prompts","count":16},{"language":"default","tag":"Citations","count":15},{"language":"default","tag":"Set Up Your Project","count":12},{"language":"default","tag":"Responses","count":12}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"widgets/cta/cta.css","content":".promptwatch-cta-widget{width:100%;max-width:290px;margin-top:1rem;margin-right:auto;margin-left:auto}.promptwatch-cta-box{padding:1.25rem;background:linear-gradient(\n 180deg,\n color-mix(in srgb, #155eef 6%, white),\n white 62%\n );border:1px solid color-mix(in srgb, #155eef 24%, transparent);border-radius:14px}.promptwatch-cta-logo{display:block;width:auto;height:24px;margin-bottom:0.9rem}.promptwatch-cta-logo-dark{display:none}.promptwatch-cta-title{margin:0;font-size:1.125rem;font-weight:700;line-height:1.4;color:#0f172a}.promptwatch-cta-description{margin:0.6rem 0 1rem;font-size:0.94rem;line-height:1.55;color:#334155}.promptwatch-cta-buttons{display:flex;flex-direction:column;gap:0.55rem;width:100%}.promptwatch-cta-btn-primary{display:inline-flex;align-items:center;justify-content:center;width:100%;padding:0.65rem 0.95rem;font-size:0.875rem;font-weight:600;line-height:1;color:#ffffff;text-decoration:none;background:#155eef;border:1px solid #155eef;border-radius:0.6rem;transition:background-color 0.16s ease,\n border-color 0.16s ease,\n transform 0.16s ease}.promptwatch-cta-btn-primary:hover{background:#0d4fd1;border-color:#0d4fd1;transform:translateY(-1px)}.promptwatch-cta-btn-primary:focus-visible{outline:2px solid #6196ff;outline-offset:2px}.promptwatch-cta-btn-secondary{display:inline-flex;align-items:center;justify-content:center;width:100%;padding:0.65rem 0.95rem;font-size:0.875rem;font-weight:600;line-height:1;color:#155eef;text-decoration:none;background:transparent;border:1px solid #155eef;border-radius:0.6rem;transition:background-color 0.16s ease,\n border-color 0.16s ease,\n color 0.16s ease,\n transform 0.16s ease}.promptwatch-cta-btn-secondary:hover{color:#0d4fd1;background:color-mix(in srgb, #155eef 10%, transparent);border-color:#0d4fd1;transform:translateY(-1px)}.promptwatch-cta-btn-secondary:focus-visible{outline:2px solid #6196ff;outline-offset:2px}.dark .promptwatch-cta-box{background:linear-gradient(\n 180deg,\n color-mix(in srgb, #155eef 22%, #0b1220),\n #0b1220 70%\n );border-color:color-mix(in srgb, #6196ff 36%, transparent)}.dark .promptwatch-cta-logo-light{display:none}.dark .promptwatch-cta-logo-dark{display:block}.dark .promptwatch-cta-title{color:#eef2ff}.dark .promptwatch-cta-description{color:#cbd5e1}.dark .promptwatch-cta-btn-secondary{color:#c7d9ff;border-color:#6196ff}.dark .promptwatch-cta-btn-secondary:hover{color:#e7efff;background:color-mix(in srgb, #6196ff 18%, transparent);border-color:#8eb3ff}@media (max-width: 768px){.promptwatch-cta-box{padding:1rem}}"}]}
{"page":{"pagePath":"crawler-logs/cloudflare-workers","slug":"/crawler-logs/cloudflare-workers","pageMetadata":{"title":"Cloudflare Workers","description":"Deploy a Cloudflare Worker to stream crawler logs","href":"/crawler-logs/cloudflare-workers"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Deploy a Cloudflare Worker to stream crawler logs\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,CodeBlock,Heading,Note,OptimizedImage,Tab,Table,Tabs,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:0},children:_jsx(OptimizedImage,{alt:`Cloudflare`,height:`40`,src:`https://www.promptwatch.com/docs/integration-logos/card/cloudflare.png`,width:`40`})}),`\n`,_jsx(`p`,{style:{textAlign:`center`,color:`#6b7280`,marginTop:8,marginBottom:24},children:_jsx(_components.p,{children:`Deploy a Worker to analyze your traffic`})}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Auto Deploy`,id:`auto-deploy`,\"data-child-heading-ids\":`[\"step-1%3A-create-an-api-token-on-cloudflare\",\"step-2%3A-paste-the-token-and-deploy\"]`,children:[_jsx(`p`,{className:`mint-font-medium mint-text-sm`,children:`Create an access token so Promptwatch can deploy the crawler log Worker for you`}),_jsx(`p`,{className:`text-muted-foreground mint-text-xs`,children:_jsx(_components.p,{children:`We’ll automatically discover your Cloudflare zone, upload the script, and configure the route.`})}),_jsx(`p`,{className:`mint-font-bold text-muted-foreground mint-text-xs mint-italic`,children:`The token is only used for this deployment and is never stored.`}),_jsx(Heading,{level:`3`,id:`step-1-create-an-api-token-on-cloudflare`,children:`Step 1: Create an API token on Cloudflare`}),_jsx(`p`,{className:`text-muted-foreground mint-text-xs`,children:_jsxs(_components.p,{children:[`Go to`,` `,`\n`,_jsx(`a`,{href:`https://dash.cloudflare.com/profile/api-tokens`,children:`dash.cloudflare.com → My Profile → API Tokens`}),` `,`\nand create a new `,_jsx(`span`,{className:`mint-font-medium`,children:`Custom Token`}),`.`]})}),_jsx(`p`,{className:`text-muted-foreground mint-text-xs`,children:`Enable the following permissions:`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Account / Workers Scripts / Edit`}),` — Upload the crawler-log Worker script`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Zone / Zone / Read`}),` — Locate your Cloudflare zone by domain name`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Zone / Workers Routes / Edit`}),` — Attach the script to your domain route`]}),`\n`]}),_jsx(Heading,{level:`3`,id:`step-2-paste-the-token-and-deploy`,children:`Step 2: Paste the token and deploy`}),_jsx(`p`,{className:`text-muted-foreground mint-text-xs`,children:`We’ll take it from here — the rest is automatic.`}),_jsx(Note,{children:_jsxs(_components.p,{children:[`Auto-deploy is only available inside the Promptwatch app. Open `,_jsx(_components.strong,{children:`Crawler Logs → Settings`}),`, select `,_jsx(_components.strong,{children:`Cloudflare Workers`}),`, switch to the `,_jsx(_components.strong,{children:`Auto Deploy`}),` tab, paste your Cloudflare API token, and click `,_jsx(_components.strong,{children:`Deploy Worker`}),`.`]})})]}),_jsxs(Tab,{title:`Manual`,id:`manual`,\"data-child-heading-ids\":`[\"step-1%3A-create-an-api-key\",\"step-2%3A-create-an-application\",\"step-3%3A-paste-the-worker-script\",\"step-4%3A-environment-variables\",\"step-5%3A-deploy-to-a-route\",\"step-6%3A-verify-cloudflare-proxy-is-enabled\",\"step-7%3A-finish\"]`,children:[_jsx(Heading,{level:`3`,id:`step-1-create-an-api-key`,children:`Step 1: Create an API Key`}),_jsxs(_components.p,{children:[`Create an API key in Promptwatch. Go to `,_jsx(_components.strong,{children:`Settings → API Keys`}),` in your `,_jsx(_components.a,{href:`https://app.promptwatch.com`,children:`Promptwatch dashboard`}),`.`]}),_jsx(Heading,{level:`3`,id:`step-2-create-an-application`,children:`Step 2: Create an Application`}),_jsx(_components.p,{children:`Create a new application in your Cloudflare account:`}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Go to your `,_jsx(_components.a,{href:`https://dash.cloudflare.com`,children:`Cloudflare dashboard`}),` → `,_jsx(_components.strong,{children:`Workers \u0026 Pages`})]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Create application`})]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Start with Hello World!`})]}),`\n`,_jsxs(_components.li,{children:[`Give it a name (e.g., `,_jsx(_components.code,{children:`promptwatch-analytics`}),`)`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Deploy`})]}),`\n`]}),_jsx(Heading,{level:`3`,id:`step-3-paste-the-worker-script`,children:`Step 3: Paste the Worker Script`}),_jsxs(_components.p,{children:[`On the Worker page, click `,_jsx(_components.strong,{children:`Edit`}),` in the top right corner and paste in the code below:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`47`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`47`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`/**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * Cloudflare Worker - stream page views to analytics server`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` *`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * Sends JSON in the expected crawler logs schema.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * Content type filtering is handled server-side.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ANALYTICS_ENDPOINT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://logs.promptwatch.com/event\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`pathname`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`search`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` URL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 1. Make the upstream request (cache/origin)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` contentType`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content-type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)?.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`split`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\";\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` queryString`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` search`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`startsWith`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` search`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` search`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`slice`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 2. Build the log object`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` log`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` timestamp:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toISOString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status_code:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request_method:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`method`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request_path:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` pathname`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` query_string:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` queryString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` content_type:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` contentType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client_ip:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"CF-Connecting-IP\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`||`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` hostname:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Host\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`||`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` user_agent:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"User-Agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`||`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` referrer:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Referer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`||`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` };`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 3. Fire-and-forget upload - never delays the visitor`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`waitUntil`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`ANALYTICS_ENDPOINT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-API-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`ANALYTICS_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {}), `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// swallow network errors`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` );`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`}`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsx(_components.p,{children:`Promptwatch identifies AI crawlers automatically and only stores AI crawler visits, all other traffic is discarded. You can safely send all your server logs without worrying about non-crawler data being retained.`}),_jsx(_components.p,{children:`If you prefer to only forward AI crawler traffic, you can use the user agents listed below to pre-filter on your side. Keep in mind that you’ll need to maintain this list yourself as new crawlers emerge.`}),_jsxs(AccordionGroup,{children:[_jsx(Accordion,{title:`OpenAI (4)`,id:`openai-4`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`GPT Bot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`GPTBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.3; +https://openai.com/gptbot`})}),_jsx(_components.td,{children:`Used to crawl content for training OpenAI’s generative AI foundation models.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`SearchBot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`OAI-SearchBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36; compatible; OAI-SearchBot/1.3; +https://openai.com/searchbot`})}),_jsx(_components.td,{children:`Used by ChatGPT search to surface websites in search results.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`ChatGPT Citations`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`ChatGPT-User`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot`})}),_jsx(_components.td,{children:`Used for user actions in ChatGPT when visiting web pages.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Ads Bot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`OAI-AdsBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OAI-AdsBot/1.0; +https://openai.com/adsbot`})}),_jsx(_components.td,{children:`Used to validate the safety of web pages submitted as ads on ChatGPT.`})]})]})]})}),_jsx(Accordion,{title:`Anthropic (4)`,id:`anthropic-4`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Claude Bot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`ClaudeBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ClaudeBot/1.0; +claudebot@anthropic.com)`})}),_jsx(_components.td,{children:`Used to crawl content for training Anthropic’s generative AI models.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Claude Citations`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Claude-User`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; Claude-User/1.0; +claudebot@anthropic.com)`})}),_jsx(_components.td,{children:`When individuals ask questions to Claude or use Claude Code, it may access websites using a Claude-User agent.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Claude Search Bot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Claude-SearchBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Claude-SearchBot/1.0; +searchbot@anthropic.com)`})}),_jsx(_components.td,{children:`Navigates the web to improve search result quality for users.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Claude Web`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`claude-web`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (compatible; claude-web/1.0; +http://www.anthropic.com/bot.html)`})}),_jsx(_components.td,{children:`Targeted crawler for recent web content, feeding the Claude browser agent with updated site data.`})]})]})]})}),_jsx(Accordion,{title:`Google (3)`,id:`google-3`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Gemini`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Google-Extended`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (compatible; Google-Extended/1.0; +http://www.google.com/bot.html)`})}),_jsx(_components.td,{children:`Controls whether content can be used for training Gemini AI models.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Google Mobile Agent`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Google-Agent`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/W.X.Y.Z Mobile Safari/537.36 (compatible; Google-Agent; +https://developers.google.com/crawling/docs/crawlers-fetchers/google-agent)`})}),_jsx(_components.td,{children:`Used by Google AI agents to autonomously browse the web and complete tasks on behalf of users (mobile).`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Google Desktop Agent`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Google-Agent`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Google-Agent; +https://developers.google.com/crawling/docs/crawlers-fetchers/google-agent) Chrome/W.X.Y.Z Safari/537.36`})}),_jsx(_components.td,{children:`Used by Google AI agents to autonomously browse the web and complete tasks on behalf of users (desktop).`})]})]})]})}),_jsx(Accordion,{title:`Perplexity (2)`,id:`perplexity-2`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Perplexity Bot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`PerplexityBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; PerplexityBot/1.0; +https://perplexity.ai/perplexitybot)`})}),_jsx(_components.td,{children:`Used to surface and link websites in Perplexity search results.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Perplexity Citations`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Perplexity-User`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Perplexity-User/1.0; +https://perplexity.ai/perplexity-user)`})}),_jsx(_components.td,{children:`Used for user actions in Perplexity when visiting web pages to answer questions.`})]})]})]})}),_jsx(Accordion,{title:`Cohere (1)`,id:`cohere-1`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Cohere AI`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`cohere-ai`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (compatible; cohere-ai/1.0; +http://www.cohere.ai/bot.html)`})}),_jsx(_components.td,{children:`Collects textual data for Cohere’s language models, helping refine large-scale text generation.`})]})})]})}),_jsx(Accordion,{title:`Mistral (2)`,id:`mistral-2`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Mistral AI Citations`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`MistralAI-User`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; MistralAI-User/1.0; +https://docs.mistral.ai/robots)`})}),_jsx(_components.td,{children:`Used for user actions in LeChat when visiting web pages to answer questions.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Mistral AI Index`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`MistralAI-Index`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; MistralAI-Index/1.0; +https://docs.mistral.ai/robots)`})}),_jsx(_components.td,{children:`Used to index content for Mistral AI’s search engine, which helps answer user questions in Le Chat.`})]})]})]})}),_jsx(Accordion,{title:`DeepSeek (1)`,id:`deepseek-1`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`DeepSeek`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`DeepSeekBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (compatible; DeepSeekBot/1.0; +http://www.deepseek.com/bot.html)`})}),_jsx(_components.td,{children:`Used to crawl content for training DeepSeek’s generative AI models.`})]})})]})}),_jsx(Accordion,{title:`xAI / Grok (3)`,id:`xai-grok-3`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Grok Bot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`GrokBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`GrokBot/1.0 (+https://x.ai)`})}),_jsx(_components.td,{children:`Used for training Grok AI.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Grok Search`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`xAI-Grok`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`xAI-Grok/1.0 (+https://grok.com)`})}),_jsx(_components.td,{children:`Used for Grok’s search capabilities.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Grok Deep Search`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Grok-DeepSearch`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Grok-DeepSearch/1.0 (+https://x.ai)`})}),_jsx(_components.td,{children:`Used for Grok’s advanced search capabilities.`})]})]})]})}),_jsx(Accordion,{title:`Exa (2)`,id:`exa-2`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`User Agent`}),_jsx(_components.th,{children:`Full User Agent`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Exa Search Bot`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`ExaSearchBot`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (compatible; ExaSearchBot/1.0; +https://crawler.exa.ai/)`})}),_jsx(_components.td,{children:`Crawls the public web to build the index behind Exa’s search API, which AI agents and apps use to find and cite pages.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Exa Citations`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`ExaUser`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Mozilla/5.0 (compatible; ExaUser/1.0; +https://exauser.crawler.exa.ai)`})}),_jsx(_components.td,{children:`Fetches a page live when a user, or an application built on the Exa API, asks for its current content.`})]})]})]})})]}),_jsx(Heading,{level:`3`,id:`step-4-environment-variables`,children:`Step 4: Environment Variables`}),_jsx(_components.p,{children:`In your Worker settings, add a secret for your API key:`}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Open the `,_jsx(_components.strong,{children:`Settings`}),` tab for your Worker`]}),`\n`,_jsxs(_components.li,{children:[`Under `,_jsx(_components.strong,{children:`Variables and secrets`}),`, click `,_jsx(_components.strong,{children:`Add`})]}),`\n`,_jsxs(_components.li,{children:[`Select `,_jsx(_components.strong,{children:`Secret`})]}),`\n`,_jsxs(_components.li,{children:[`Set the name to `,_jsx(_components.code,{children:`ANALYTICS_KEY`})]}),`\n`,_jsx(_components.li,{children:`Set the value to the API key you created in Step 1`}),`\n`]}),_jsx(Heading,{level:`3`,id:`step-5-deploy-to-a-route`,children:`Step 5: Deploy to a Route`}),_jsx(_components.p,{children:`Deploy your Worker to a route:`}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Navigate to `,_jsx(_components.strong,{children:`Domains`})]}),`\n`,_jsx(_components.li,{children:`Select the domain you’re setting up`}),`\n`,_jsxs(_components.li,{children:[`In the left-hand navigation, click `,_jsx(_components.strong,{children:`Worker Routes`})]}),`\n`,_jsxs(_components.li,{children:[`Add a new route: `,_jsx(_components.code,{children:`yourdomain.com/*`})]}),`\n`,_jsx(_components.li,{children:`Select your Worker from the dropdown`}),`\n`,_jsx(_components.li,{children:`Save and deploy`}),`\n`]}),_jsx(Warning,{children:_jsx(_components.p,{children:`The Worker will intercept all requests to your domain. It transparently passes through all traffic while logging HTML page views to Promptwatch.`})}),_jsx(Heading,{level:`3`,id:`step-6-verify-cloudflare-proxy-is-enabled`,children:`Step 6: Verify Cloudflare Proxy is Enabled`}),_jsxs(_components.p,{children:[`Verify your domain’s DNS records have the `,_jsx(_components.strong,{children:`Cloudflare proxy enabled`}),` (orange cloud icon). Workers Routes only intercept traffic that flows through the Cloudflare network. If the proxy is off (gray cloud / “DNS only”), requests go directly to your origin and bypass the Worker entirely.`]}),_jsxs(_components.p,{children:[`Go to your Cloudflare dashboard → `,_jsx(_components.strong,{children:`DNS`}),` → `,_jsx(_components.strong,{children:`Records`}),` and make sure the `,_jsx(_components.strong,{children:`Proxy status`}),` shows the orange cloud (“Proxied”) for your domain’s A/AAAA/CNAME records.`]}),_jsx(OptimizedImage,{src:`https://mintcdn.com/promptwatch/zIch_xXSzUzN_M1-/crawler-logs/cloudflare-proxy-enabled.jpeg?fit=max\u0026auto=format\u0026n=zIch_xXSzUzN_M1-\u0026q=85\u0026s=f4e04ea761a7e82b5d64bef4cdf474ce`,alt:`Cloudflare DNS proxy enabled`,style:{maxWidth:240,borderRadius:8},\"data-og-width\":`598`,width:`598`,\"data-og-height\":`330`,height:`330`,\"data-path\":`crawler-logs/cloudflare-proxy-enabled.jpeg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/promptwatch/zIch_xXSzUzN_M1-/crawler-logs/cloudflare-proxy-enabled.jpeg?w=280\u0026fit=max\u0026auto=format\u0026n=zIch_xXSzUzN_M1-\u0026q=85\u0026s=52408ebeb57532085d41ca960396894d 280w, https://mintcdn.com/promptwatch/zIch_xXSzUzN_M1-/crawler-logs/cloudflare-proxy-enabled.jpeg?w=560\u0026fit=max\u0026auto=format\u0026n=zIch_xXSzUzN_M1-\u0026q=85\u0026s=ee33252ee0582920807d220b73cb4998 560w, https://mintcdn.com/promptwatch/zIch_xXSzUzN_M1-/crawler-logs/cloudflare-proxy-enabled.jpeg?w=840\u0026fit=max\u0026auto=format\u0026n=zIch_xXSzUzN_M1-\u0026q=85\u0026s=1cbbd62ac03dde5d0725eb2a0c88a215 840w, https://mintcdn.com/promptwatch/zIch_xXSzUzN_M1-/crawler-logs/cloudflare-proxy-enabled.jpeg?w=1100\u0026fit=max\u0026auto=format\u0026n=zIch_xXSzUzN_M1-\u0026q=85\u0026s=33cb5e0a67b569883d73cb9014f8e7b5 1100w, https://mintcdn.com/promptwatch/zIch_xXSzUzN_M1-/crawler-logs/cloudflare-proxy-enabled.jpeg?w=1650\u0026fit=max\u0026auto=format\u0026n=zIch_xXSzUzN_M1-\u0026q=85\u0026s=14adf3a46a06fef95f29d4fed4de9ecf 1650w, https://mintcdn.com/promptwatch/zIch_xXSzUzN_M1-/crawler-logs/cloudflare-proxy-enabled.jpeg?w=2500\u0026fit=max\u0026auto=format\u0026n=zIch_xXSzUzN_M1-\u0026q=85\u0026s=25414dff472a1e82ee91d9882333f096 2500w`}),_jsx(Heading,{level:`3`,id:`step-7-finish`,children:`Step 7: Finish`}),_jsx(_components.p,{children:`Once deployed, your Worker will automatically send crawler logs to Promptwatch.`})]})]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`For a full list of API response codes, see `,_jsx(_components.a,{href:`/crawler-logs/api-responses`,children:`API Response Codes`}),`.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Cloudflare Workers","description":"Deploy a Cloudflare Worker to stream crawler logs","href":"/crawler-logs/cloudflare-workers"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Step 1: Create an API token on Cloudflare","slug":"step-1-create-an-api-token-on-cloudflare","depth":3,"children":[],"tabId":"auto-deploy"},{"title":"Step 2: Paste the token and deploy","slug":"step-2-paste-the-token-and-deploy","depth":3,"children":[],"tabId":"auto-deploy"},{"title":"Step 1: Create an API Key","slug":"step-1-create-an-api-key","depth":3,"children":[],"tabId":"manual"},{"title":"Step 2: Create an Application","slug":"step-2-create-an-application","depth":3,"children":[],"tabId":"manual"},{"title":"Step 3: Paste the Worker Script","slug":"step-3-paste-the-worker-script","depth":3,"children":[],"tabId":"manual"},{"title":"Step 4: Environment Variables","slug":"step-4-environment-variables","depth":3,"children":[],"tabId":"manual"},{"title":"Step 5: Deploy to a Route","slug":"step-5-deploy-to-a-route","depth":3,"children":[],"tabId":"manual"},{"title":"Step 6: Verify Cloudflare Proxy is Enabled","slug":"step-6-verify-cloudflare-proxy-is-enabled","depth":3,"children":[],"tabId":"manual"},{"title":"Step 7: Finish","slug":"step-7-finish","depth":3,"children":[],"tabId":"manual"}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/promptwatch/550da6aed460c9b9/widgets/cta/cta.js"],"dynamicCss":".mint-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem\n}\n.mint-text-xs {\n font-size: 0.75rem;\n line-height: 1rem\n}\n.mint-font-bold {\n font-weight: 700\n}\n.mint-font-medium {\n font-weight: 500\n}\n.mint-italic {\n font-style: italic\n}","subdomain":"promptwatch","siteName":"Promptwatch API Documentation","title":"Cloudflare Workers - Promptwatch API Documentation","navMaps":{"firstHrefInVersion":{"API V2":{"href":"/crawler-logs/cloudflare-workers","matchLevel":0},"API V1 (Legacy)":{"href":"/v1/introduction","matchLevel":3}},"firstHrefInLanguage":{}},"lastModified":"2026-11-13T08:46:15.082Z","originalFileLocation":"crawler-logs/cloudflare-workers.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Deploy a Cloudflare Worker to stream crawler logs\">\u003cmeta data-mint-head name=\"application-name\" content=\"Promptwatch API Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Cloudflare Workers - Promptwatch API Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Deploy a Cloudflare Worker to stream crawler logs\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Promptwatch API Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://promptwatch.mintlify.site/docs/_mintlify/api/og/v2?division=CDN+Providers\u0026amp;title=Cloudflare+Workers\u0026amp;description=Deploy+a+Cloudflare+Worker+to+stream+crawler+logs\u0026amp;theme=e6f7d3ed952b986bddaaaee7\u0026amp;signature=c255d5a895998d724e9eb8677ed9ad87708ae2a09715d4da6ffb95097b1dd946\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Cloudflare Workers - Promptwatch API Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Deploy a Cloudflare Worker to stream crawler logs\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://promptwatch.mintlify.site/docs/_mintlify/api/og/v2?division=CDN+Providers\u0026amp;title=Cloudflare+Workers\u0026amp;description=Deploy+a+Cloudflare+Worker+to+stream+crawler+logs\u0026amp;theme=e6f7d3ed952b986bddaaaee7\u0026amp;signature=c255d5a895998d724e9eb8677ed9ad87708ae2a09715d4da6ffb95097b1dd946\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/promptwatch/-sGw9jhPsbE8OkV9/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Promptwatch API Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#155EEF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/crawler-logs/cloudflare-workers.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://promptwatch.com/#organization\",\"name\":\"Promptwatch API Documentation\",\"url\":\"https://promptwatch.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/promptwatch/FBwQmv0BrcUvup55/logo/text-logo-light.svg?fit=max\u0026auto=format\u0026n=FBwQmv0BrcUvup55\u0026q=85\u0026s=6ff2b45e7fb7b0343f0a0cdc24a4df3e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://promptwatch.com/docs#website\",\"name\":\"Promptwatch API Documentation\",\"url\":\"https://promptwatch.com/docs\",\"publisher\":{\"@id\":\"https://promptwatch.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers#webpage\",\"url\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers\",\"name\":\"Cloudflare Workers\",\"description\":\"Deploy a Cloudflare Worker to stream crawler logs\",\"dateModified\":\"2026-11-13T08:46:15.082Z\",\"isPartOf\":{\"@id\":\"https://promptwatch.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"CDN Providers\",\"item\":\"https://promptwatch.com/docs/crawler-logs/akamai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cloudflare Workers\",\"item\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers#article\",\"headline\":\"Cloudflare Workers\",\"name\":\"Cloudflare Workers\",\"description\":\"Deploy a Cloudflare Worker to stream crawler logs\",\"url\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers\",\"mainEntityOfPage\":{\"@id\":\"https://promptwatch.com/docs/crawler-logs/cloudflare-workers#webpage\"},\"dateModified\":\"2026-11-13T08:46:15.082Z\",\"publisher\":{\"@id\":\"https://promptwatch.com/#organization\"},\"isPartOf\":{\"@id\":\"https://promptwatch.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Promptwatch API Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Promptwatch API Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/crawler-logs/cloudflare-workers.md","siteName":"Promptwatch API Documentation","nav":{"global":null,"versions":[{"version":"API V2","tabs":[{"tab":"Promptwatch Academy","pages":[{"title":"Promptwatch Academy","href":"/academy"}]},{"tab":"API Documentation","pages":[{"title":"API Documentation","href":"/introduction"}]},{"tab":"MCP Documentation","pages":[{"title":"MCP Documentation","href":"/mcp/introduction"}]},{"tab":"Crawler log setup","groups":[{"group":"Overview","icon":"book-open","pages":[{"title":"Getting Started","href":"/crawler-logs/getting-started"}]},{"group":"CDN Providers","icon":"cloud","pages":[{"title":"Akamai","href":"/crawler-logs/akamai"},{"title":"AWS CloudFront","href":"/crawler-logs/cloudfront"},{"title":"Fastly","href":"/crawler-logs/fastly"},{"title":"Google Cloud CDN","href":"/crawler-logs/gcp"},{"title":"Netlify","href":"/crawler-logs/netlify"},{"title":"Vercel","href":"/crawler-logs/vercel"},{"title":"Cloudflare Logpush","description":"Configure crawler log ingestion via Cloudflare Logpush","href":"/crawler-logs/cloudflare-logpush"},{"title":"Cloudflare Workers","href":"/crawler-logs/cloudflare-workers"},{"title":"Manual Setup","description":"Send crawler logs via HTTP POST","href":"/crawler-logs/manual"}]},{"group":"Platform","icon":"layers","pages":[{"title":"WP Engine + Cloudflare","href":"/crawler-logs/wp-engine-cloudflare"},{"title":"Webflow + Cloudflare","href":"/crawler-logs/webflow-cloudflare"},{"title":"Shopify + Cloudflare","href":"/crawler-logs/shopify-cloudflare"},{"title":"Kinsta + Cloudflare","href":"/crawler-logs/kinsta-cloudflare"},{"title":"HubSpot + Cloudflare","href":"/crawler-logs/hubspot-cloudflare"}]},{"group":"CMS","icon":"blocks","pages":[{"title":"WordPress","href":"/crawler-logs/wordpress"}]},{"group":"Reference","icon":"code","pages":[{"title":"API Responses","href":"/crawler-logs/api-responses"}]}]}]},{"version":"API V1 (Legacy)","pages":[{"title":"API V1 (Legacy)","href":"/v1/introduction"}]}]},"basePath":"","title":"Cloudflare Workers - Promptwatch API Documentation","deploymentId":"dpl_B1qJC7o4Nbc1BrDLB8Y5TDHq3c2t","buildId":"dpl_B1qJC7o4Nbc1BrDLB8Y5TDHq3c2t","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-Dq2Z5ult.js","lightbox-handle-r17bVUz3.js"]}