If the site used Cloudflare Web Analytics before the tracking script, Lundot can import what Cloudflare still holds, once. Lundot gives up its access when the import ends.
With the Cloudflare setup
If Cloudflare is not connected yet, do both at once: Sign in with Cloudflare in Setup also asks for Account Analytics: Read (optional, selected), and Also import Cloudflare Web Analytics history is ticked. An account API token from Use an API token instead has the same permissions. Once the Worker is added, Lundot starts the import:
- from the account the Worker was added to;
- from the Cloudflare site with the most page views on your hostnames in the last 30 days;
- only if the site has no imported history yet.
A token can also edit Workers, so set its TTL to end tomorrow. Without Account Analytics: Read, the import is skipped. Otherwise, use the steps below.
What is imported
For each day before your tracking script started, back to the oldest day Cloudflare still serves (about six months): page views and visits, and the top pages, referrers, countries, devices, browsers and operating systems.
Cloudflare keeps sampled daily totals, so figures are estimates and a small site's numbers can move in steps of ten. It has no unique visitors, bounces or time on page: each imported day's visits count as its visitors.
Before you start
- The tracking script installed or about to be (the import stops the day before its first event).
- A Cloudflare account where Web Analytics measured the site.
- A Lundot role that can change the site's tracking (admin or owner).
Import
In Settings, open Connections and find Cloudflare under Other connections. Select Import history, or Only import history if the site has no Worker. A new import replaces a finished or failed one.
Sign in with Cloudflare
Offered where the server has Cloudflare sign-in set up:
- Select Sign in with Cloudflare and allow Account Analytics: Read, the only permission asked.
- Back in Connections, Lundot names the Cloudflare site it imports from. If more than one account has your page views, nothing is imported and the row lists the matches: sign in again allowing only one account, or use a token made in it.
If you clear Account Analytics: Read or cancel, nothing is imported.
Use an account API token
Select Use an API token instead. Where sign-in is not set up, this is the only way.
- Select Open Cloudflare for the pre-filled account API token form (Manage Account, Account API Tokens). Under Zone Resources, choose your site's zone; for history only, Account Analytics: Read alone is enough. Set the TTL end date to tomorrow, then create and copy the token.
- Paste it and select Import history. Six months take about two minutes, up to ten for a site with over 1,000 distinct pages or referrers a day.
Delete the token in Cloudflare afterwards; Lundot has already deleted its copy.
What the token check refuses
The same check applies to the Worker, the history and the removal. It refuses a token that:
- is a user token from My Profile, API Tokens, not an account API token;
- is disabled or has expired;
- reaches more than one Cloudflare account, or more than your site's zone;
- misses one of the four permissions;
- can do more, such as DNS, KV, R2, D1, Pages, Access, account rulesets, account members or account API tokens. A history-only token must not reach any zone or Worker either.
The message names the permission to add or remove. If Cloudflare does not answer a check, Lundot refuses the token.
How imported days show in reports
- Page views, visits and visitors include imported days in the totals, chart, site overview and Sites list.
- Bounce rate and visit duration use the tracking script only.
- Breakdowns show imported rows apart, under the card.
- A line under the Web chart names the imported days.
- With a filter on, imported days are left out: Cloudflare's totals cannot be filtered.
Only days that ended before the script's first event are imported, so nothing is counted twice. Days are Cloudflare's UTC days.
Import again or remove
Import again replaces the earlier import once the new one finishes.
Remove history deletes every imported day and stops a running import; tracking script data stays. Deleting all of a site's data in its settings keeps imported history; deleting the site removes it.
If the import stops
- Cloudflare stopped accepting the token part-way (deleted, changed or expired, or a grant could not be renewed): the unfinished import is dropped; an earlier finished import keeps showing. Select Try again with a new token.
- The import stopped making progress: dropped the same way. Select Try again.
- Nothing to import: Cloudflare holds no day before your tracking script started.