Cloudflare Docs
Analytics
Analytics
Edit this page
Give us feedback
Set theme to dark (⇧+D)

Enabling Cloudflare Web Analytics

​​ Sites not proxied through Cloudflare

  1. Log in to the Cloudflare dashboard, and select your account.
  2. Select the Analytics & Logs drop-down and choose Web Analytics.
  3. Select Add a site.
  4. In Set up hostname, write your website’s hostname.
  5. Select the message box that appears to choose the hostname you have input and select Done.
  6. Copy the JS snippet from Manage site. This is also where you can later edit the hostname you have just added.
  7. (Optional) Select View Analytics sites to go back on the Web Analytics interface. If you prefer to continue setting up Web Analytics website, continue reading.
  8. Add the JS snippet to any of your website’s HTML pages before the ending body tag.

Web analytics is now set up on your website, but it may take a few minutes for Web Analytics data to appear.

Repeat steps 3-7 for all the websites you want to track with Web Analytics by selecting Add a site from Web Analytics. In Web Analytics Sites, select Manage site inside each website’s card to adjust Web Analytics for your site at any time.

For more information on how many sites you can track, refer to Limits.


​​ Sites proxied through Cloudflare

  1. Log in to the Cloudflare dashboard, and select your account.
  2. Select the Analytics & Logs drop-down and choose Web Analytics.
  3. Select Add a site.
  4. Select a hostname from the drop-down menu > Done.

Your website is now using Web Analytics through the automatic setup, which is enabled by default.

To set up Web Analytics manually:

  1. After step 4 (above), expand Advanced options.
  2. Select Disable automatic setup.
  3. Copy the JS snippet.
  4. Add the JS snippet to any of your website’s HTML pages before the ending body tag.

Repeat these steps for all of the websites you want to track with Web Analytics. Web Analytics is enabled by default for sites proxied through Cloudflare that previously used Browser Insights. Adjust Web Analytics for your site at any time by selecting Manage site from Web Analytics.

For more information on how many sites you can track, refer to Limits.

For more information on how to configure which sites or pages you track with Web Analytics, refer to Rules.


​​ Pages projects

Cloudflare Pages offers a one-click setup for Web Analytics:

  1. Log in to Cloudflare dashboard.
  2. From Account Home, select Workers & Pages.
  3. In Overview, select your Pages project.
  4. Go to Manage > Web Analytics > and select Enable Web Analytics.

Cloudflare will automatically add the JavaScript snippet to your Pages site on the next deployment.