Comparison of Cloudflare and Google Analytics Data: Personal Experience

Some time ago, I wrote an article showing how much data is missed if you rely on only client-side web analytics numbers. To maintain this previous blog post in an actual state, I planned to update it from time to time. However, as you might expect, pretty soon, I got bored collecting manually Cloudflare and Google Analytics data and inserting it into a spreadsheet. As a normal human, I have decided to automate the process. Luckily, both systems provide the APIs that you can use to query and download the data. However, during the development of the data collection script, I discovered several limitations that inclined me to write a new blog post instead of updating the old one.

Table of Contents

Introduction

Here are two main shortcomings:

  1. Using the Cloudflare API, it is possible to get the number of pageviews. This information is not available through the provided UI. Thus, the previous article does not explore this metric.
  2. It is required to bring the numbers up to date manually in the previous blog post. That makes it difficult to update it regularly.

This blog post cures these shortcomings:

  1. The data for this blog post are collected automatically. That makes the reported numbers more reliable.
  2. In this blog post, I also consider the pageview data.
  3. Last but not least, to report the numbers, I use template variables (more on this in the upcoming post).

Although the data in the previous post is obsolete, I still recommend reading it to understand my motivation to conduct this research.

Analysis

Although I moved my website to Cloudflare on the July 7, 2021, I started to collect the data through Cloudflare API only after I had developed the data collection script. Therefore, I have the data only from July 7, 2021.

Thus, in this article I rely on the data from July 7, 2021 to February 25, 2023.

Visitors

Unfortunately, as I wrote in the previous post Google and Cloudflare consider as Visitors slightly different things. Google uses the term Users that represents the amount of recorded unique identifiers during a period (day). Cloudflare uses the term Unique Visitorsthe number of unique IP addresses querying a website during a period. Thus, in general, we cannot directly compare these metrics because they measure different concepts. However, to me, they are close to each other (and the high correlation value confirms this). Hence, I compare them in this post. Within the article, I use the term Visitors to represent these two metrics.

Below, you can see the graph comparing the number of visitors: the lower line shows the amount of Users reported by Google Analytics, and the upper one shows the number of Unique Visitors provided by Cloudflare.

In general, Cloudflare shows higher numbers for the amount of visitors. According to Cloudflare, every day my website visits on average 533 Unique Visitors. Google Analytics notices only 141 Users on average a day. Thus, on average Cloudflare registers 4.1 times more visitors than Google Analytics. Cloudflare’s Unique Visitors and Google Analytics’s Users metrics are correlated: Pearson correlation is 0.60.

For the last 30 days (a month) the numbers are the following:

  • Total number of visitors:
    • Google Analytics: 4227
    • Cloudflare: 18360
  • Average amount of visitors per day:
    • Google Analytics: 141
    • Cloudflare: 612
  • Pearson correlation between the metrics: 0.77

Pageviews

The amount of Pageviews is a better metric. For Cloudflare, a pageview is an event of a user querying an HTML page. Google Analytics defines a pageview as a view of a page on your site that is tracked by the Analytics tracking code.

The main reason to write this post was the discovery of the Cloudflare API providing access to the pageview data. Finally, in this article, I can compare apples with apples.

Below, you can see the graph comparing the number of pageviews collected by Cloudflare (upper line) and Google Analytics (lower line).

The trend described in the previous section holds here too: the amount of pageviews reported by Cloudflare is higher than the number recorded by Google Analytics. According to Cloudflare, each day the visitors of my website load about 901 pages. At the same time, according to Google Analytics the number is lower: only 183 views a day on average. Cloudflare shows 5.4 times larger number of pageviews than Google Analytics. As you can see, the proportion is even larger than for the visitors metric. From this observation, I can conclude that tech-savvy people check more pages on my website during a session.

Pearson correlation between these two series is also pretty high: 0.37. This confirms that these metrics are connected. Interestingly, although in the case of pageviews, we compare the same metrics, the correlation is lower than in the case of visitors data.

For the last 30 days (a month) the numbers are the following:

  • Total number of pageviews:
    • Google Analytics: 5300
    • Cloudflare: 25608
  • Average amount of pageviews per day:
    • Google Analytics: 177
    • Cloudflare: 854
  • Pearson correlation between the metrics: 0.51

Conclusion

The takeaway of this article is the same: if your income somehow depends on the web analytics numbers (e.g., you set an ad price based on the number of visitors during the previous month), then it is worth investing in setting up and maintaining server-side web analytics data collection, especially if your audience is tech-savvy people.

Related