Subscribe to receive notifications of new posts:

Enhancing privacy-focused Web Analytics to better meet your metrics needs

03/15/2021

5 min read

Last December we opened up our brand new privacy-first Web Analytics platform to everyone. Today, we’re excited to announce the release of three of the most requested features: adding multiple websites to an account, supporting Single-page Applications (SPA) as well as showing Core Web Vitals in Web Analytics.

Bringing privacy-first analytics to everyone

Since we launched two months ago, we’ve received a lot of feedback from our users. We are really happy that we are able to provide our privacy-first analytics to so many of you.

Popular analytics vendors have business models driven by ad revenue. Using them implies a bargain: they track visitor behavior and create buyer profiles to retarget your visitors with ads; in exchange, you get free analytics.

Our mission is to help build a better Internet, and part of that is to deliver essential web analytics to everyone with a website without compromising user privacy. We’ve never been interested in tracking users or selling advertising. We don’t want to know what you do on the Internet — it’s not our business.

You now can measure multiple sites

When we launched Web Analytics, each account was only able to measure one website. We are happy to announce that all users can now add up to 10 websites.

Add one or more new sites via the Cloudflare Dashboard by selecting "Add site" in Quick Actions.

For measuring multiple subdomains (a.example.com and b.example.com) there are two options:

  1. Add the root domain (example.com) to Web Analytics and add the same JavaScript snippet on all subdomains (a.example.com and b.example.com)
  2. Add the subdomains separately using multiple sites. Here you have to add separate snippets.

We use the hostname to validate the request, so remember that you can only use the JavaScript snippet if both the configured and actual hostnames match.

You can see the analytics for all your websites sites in one place

When we talked to customers about the multiple site feature, we got the feedback that it is very important to add all sites to Web Analytics and be able to track them. But they also said that it would be even more powerful to have the option to see analytics for all your sites combined in one place.

We listened. If you select "View Web Analytics for all sites’ on the Web Analytics overview page, you can now see all your sites listed and apply filters to them using site tags.

What is different for Single Page Applications (SPA)?

With frameworks such as Angular, React, or Vue.js being very popular, one of the most requested features for Web Analytics was supporting single-page applications (SPA).

SPAs work differently from a standard web application or website because they don't load a new page every time there's user interaction. Instead, they dynamically rewrite the current web page with new data retrieved from the web server.

Since we've previously collected metrics only when the page load event is triggered, we had to change the transmission and interpretation of the signals from our JavaScript snippet to include sending metrics whenever there are any route changes made by the application or the website.

We are happy to announce that we successfully implemented SPA support and enabled it for all customers.

How we are supporting SPAs

You might have noticed that some websites keep the # in the URL whenever you navigate their webpages. You would see URLs like the following:

https://cloudflare.com/#blog
https://cloudflare.com/#marketing

The portion separated by the # is called a fragment, and based on the fragment changes, SPAs dynamically pull the resources to rewrite the webpage. That is how it was done before the HTML 5 History API was introduced and widely used. These days most SPA libraries/frameworks use HTML 5 History API to keep your UI in sync with the URL instead of using # (although, some still support #-based routers). In most cases you won’t easily notice a SPA by looking at the URL path.

To support analytics for SPAs, we implemented sending additional payloads to the beacon endpoint, which collects the data for analytics, whenever we detect any changes to the state of the History API. The JavaScript snippet overrides the pushState method and listens to the onpopstate event. By tracking the History API's state, you'll now see the route changes in SPAs within the Web Analytics dashboard.

Some older SPA libraries/frameworks still support hash-based routers. If your application or website is using a hash-based router, unfortunately it is not yet supported in Web Analytics. However, this is our initial launch to support SPAs, so stay tuned for any improvements and updates.

How can I add my Single Page Application to Web Analytics?

SPA support is automatically enabled for all domains in Web Analytics.

Core Web Vitals are now available for every Web Analytics customer

Core Web Vitals is an initiative by Google to provide unified guidance for quality signals that are essential to delivering a great user experience on the web.

In September 2020, we introduced Web Vitals for customers using Browser Insights, and many customers love getting those unique insights into their website performance. But we were also aware that Browser Insights wasn't available to all our Web Analytics customers simply because they're not able to onboard to the rest of Cloudflare for Infrastructure. Specifically, they're not able to change their DNS servers.

So today, we're introducing Core Web Vitals to Web Analytics as well.

You can see the Core Web Vitals metrics in the same dashboard as Visits and Page Views and check how healthy your website performance is.

What’s next

This is just the start for our privacy-first Web Analytics.

We’re excited to integrate more closely with the rest of Cloudflare and give customers even more detailed stats about performance and security (not just traffic). We’re also hoping to make our analytics even more powerful as a standalone product by building support for alerts, real-time updates, and more.

Please let us know if you have any questions or feedback, and happy measuring!

We protect entire corporate networks, help customers build Internet-scale applications efficiently, accelerate any website or Internet application, ward off DDoS attacks, keep hackers at bay, and can help you on your journey to Zero Trust.

Visit 1.1.1.1 from any device to get started with our free app that makes your Internet faster and safer.

To learn more about our mission to help build a better Internet, start here. If you're looking for a new career direction, check out our open positions.
PrivacyAnalytics

Follow on X

Marc Lamik|@marclamik
Cloudflare|@cloudflare

Related posts

March 08, 2024 2:05 PM

Log Explorer: monitor security events without third-party storage

With the combined power of Security Analytics + Log Explorer, security teams can analyze, investigate, and monitor for security attacks natively within Cloudflare, reducing time to resolution and overall cost of ownership for customers by eliminating the need to forward logs to third-party SIEMs...