Ora

How do I enable Web Analytics for Cloudflare Workers & Pages projects?

Published in Cloudflare Analytics 4 mins read

Enabling Web Analytics for your Cloudflare Workers & Pages project provides valuable insights into your application's performance and user engagement directly from the Cloudflare dashboard. It's a straightforward process designed to help you monitor traffic, page views, and other crucial metrics without needing to deploy client-side JavaScript manually.

Step-by-Step Guide to Enabling Web Analytics for Workers & Pages

To activate Web Analytics for your Cloudflare Pages project, follow these simple steps:

  1. Log in to the Cloudflare dashboard: Navigate to [Cloudflare Dashboard](https://dash.cloudflare.com/) and enter your credentials.
  2. Navigate to Workers & Pages: From your Account Home, locate and select the Workers & Pages option. This will take you to an overview of your serverless applications and static sites.
  3. Select your Pages project: In the Overview section, find and click on the specific Pages project for which you want to enable analytics.
  4. Access Metrics and Enable Analytics:
    • Within your Pages project's dashboard, look for the Metrics tab or section.
    • Under the Metrics view, you will find the Web Analytics option.
    • Select Enable to turn on Web Analytics for your project.

Once enabled, Cloudflare will automatically start collecting and displaying analytics data for your Workers & Pages project, giving you immediate access to performance insights.

What is Cloudflare Web Analytics for Workers & Pages?

Cloudflare Web Analytics for Workers & Pages is a built-in, privacy-first analytics solution that helps you understand how users interact with your deployed applications and sites. Unlike traditional analytics tools that require embedding JavaScript snippets, this feature leverages Cloudflare's network to collect data, minimizing impact on performance and enhancing user privacy.

Key features and insights typically include:

  • Page Views: Track the total number of times pages on your site have been viewed.
  • Unique Visitors: Identify how many distinct users access your content.
  • Top Pages: See which pages are most popular among your audience.
  • Traffic Sources: Understand where your visitors are coming from (e.g., direct, referral, search engines).
  • User Geography: Get a high-level overview of your audience's geographic distribution.

This native integration simplifies data collection and provides a unified view of your project's performance alongside other Cloudflare services.

Why Use Cloudflare Web Analytics?

Leveraging Cloudflare Web Analytics offers several distinct advantages for developers and website owners:

  • Effortless Integration: No code changes or script injections are required for your Pages project; it's enabled directly from the dashboard.
  • Performance-Friendly: Since data collection happens at the network edge, it doesn't add any client-side overhead, ensuring your site remains fast.
  • Privacy-Focused: Designed with privacy in mind, it provides insights without compromising user data or requiring complex consent banners, making it easier to comply with regulations like GDPR and CCPA.
  • Holistic View: Complements Cloudflare's broader analytics offerings, giving you a more complete picture of your application's health and user base.
  • Real-time Insights: Access up-to-date information to quickly identify trends or issues.

Understanding Cloudflare's Various Analytics Offerings

Cloudflare provides several analytics tools, each serving a different purpose. While the steps above are for Workers & Pages, it's helpful to understand the broader landscape:

Feature Purpose Activation Method Data Collection Location
Workers & Pages Web Analytics Client-side behavior for sites/apps deployed on Workers & Pages. Enable via Metrics tab in Pages project settings. Cloudflare edge network
Cloudflare Analytics (for DNS/HTTP) Server-side traffic data for domains proxied through Cloudflare. Typically enabled by default for proxied domains. Cloudflare edge network
Cloudflare Web Analytics (Standalone) Client-side behavior for any website, regardless of hosting. Requires embedding a JavaScript snippet on your site. Client-side (browser)

For general Cloudflare Analytics concerning your domain's overall traffic, it's usually active by default once your domain is proxied through Cloudflare. The Cloudflare Web Analytics (standalone) can be used for any website, even those not proxied by Cloudflare, by adding a small JavaScript snippet to your site's header.