Getting Started

Cloudflare Worker setup

Create a Cloudflare Worker, add the Honeylog values, and attach it to the website domain.

Use this guide when Cloudflare handles visits to the website. You will create a Cloudflare Worker for Honeylog and connect it to the website domain.

#Before you open Cloudflare

Sign in to the Cloudflare account that manages the website. Your account must be allowed to create Workers and connect them to the website domain. If these options are not available, send this guide to the person who manages Cloudflare for you.

#Choose install method

Choose one of these methods:

  1. One-click install: use this if you have a GitHub or GitLab account that you can connect to Cloudflare.
  2. Manual install: use this if you want to complete everything in the Cloudflare dashboard without connecting GitHub or GitLab.

#One-click install

Open the private Honeylog installation page under Settings > Installation > Cloudflare Worker, then start the guided Cloudflare deployment.

  1. Create the website in Honeylog and choose Cloudflare Worker.
  2. Start the guided Cloudflare deploy from Honeylog.
  3. When Cloudflare asks for configuration values, paste only the three values shown below. Use the personalized values from Honeylog, not the placeholders in this public guide.
  4. Finish the deployment and wait until Cloudflare shows that the Worker was deployed successfully.
  5. Continue with Add domain or route below.

Values to paste into Cloudflare:

HONEYLOG_API_URL=https://api.honeylog.io/events
HONEYLOG_INGESTION_SECRET=SITE_TOKEN
HONEYLOG_SITE_DOMAIN=SITE_DOMAIN

Template defaults:

HONEYLOG_SITE_SCHEME=https
HONEYLOG_EVENT_NAME=pageview
HONEYLOG_SKIP_PATH_REGEX=\.(?:css|js|mjs|map|png|jpe?g|gif|svg|ico|webp|avif|woff2?|ttf)$

Leave the template defaults unchanged unless Honeylog support or your Cloudflare team has given you different values.

#Manual install

  1. In Cloudflare, open Workers & Pages.
Cloudflare account home with Workers and Pages highlighted
Open Workers & Pages from the Cloudflare account home.
  1. Click Create application.
Cloudflare Workers and Pages page with Create application highlighted
Create a new Workers application.
  1. Choose Start with Hello World!.
Cloudflare create Worker flow with Start with Hello World highlighted
Start from the Hello World Worker so Cloudflare creates a deployable Worker.
  1. Deploy the starter Worker and wait until Cloudflare confirms that the deployment is complete.
  2. Click Edit code, remove the starter code, and paste the complete Honeylog Worker code shown on the private installation page.
Cloudflare Worker overview with Edit code highlighted
Open the Worker editor and replace the starter code with the Honeylog Worker code.
  1. Save and deploy again. Continue only when Cloudflare shows that the new deployment is active.

Worker script:

Open worker.js

#Add variables and secrets

  1. Open the Worker settings.
Cloudflare Worker settings page with Add variable highlighted
Open Settings, then add the required variables and secrets.
  1. Add each variable and secret shown on the private Honeylog installation page. Match the name, value, and type exactly.
Cloudflare Variables and secrets panel with HONEYLOG_API_URL
Add each Honeylog variable or secret with the name and value shown in Honeylog.
  1. Leave the template defaults unchanged unless Honeylog support or your Cloudflare team has given you different values.

Before continuing, confirm that all required names appear in the Worker's Variables and Secrets list.

#Add domain or route

  1. Open the Worker's Domains section and choose Add domain or Add route.
Cloudflare Worker Domains tab with Add Domain highlighted
Open Domains and add the website domain or route for the Worker.
  1. Paste the route pattern generated by the private Honeylog installation page. The public example below uses a placeholder.
  2. Save the route and confirm that it appears in the Worker's domain list.
  3. Open a few public pages on the website.
  4. Return to Honeylog and confirm that the new visits appear. This is the final confirmation that the Worker is connected to the website.

Route pattern:

*.SITE_DOMAIN/*