A few days ago, I migrated the web analytics tool for this site. The new tool is Cloudflare Web Analytics, and the old tool is Google Analytics.
This article provides an overview of this migration process.
Why did I migrate the tool?
The reason is that I wanted to prioritize privacy-first tools.
Privacy Regulations of Each Country
In recent years, privacy has become more important. In Japan, the Act on the Protection of Personal Information was enacted in May 2003 and has since been revised multiple times. At the time this article was written, the latest revision occurred in 2021, and it came into effect this year (2023).
and stealth marketing practices.
In the European Union (EU), the General Data Protection Regulation (GDPR) came into effect in May 2018. In California, the California Consumer Privacy Act (CCPA) was enacted in June 2018 and came into effect in January 2020.
Privacy Protection of Web Advertisement
Web Advertisement Platforms also work to protect privacy. Since January 16, 2024, web publishers must use the CMP, which supports IAB TCF v2.0 and is approved by Google to display the ads on their websites to the EU region and UK audience with Google AdSense.
On sites that support IAB TCF 2.0, advertisements, even those that are not personalized, may not be displayed without user consent.
The revenue from advertisements will decrease, making it challenging for websites to operate solely on ad revenue. They should find other methods other than advertisements.
About Cloudflare Web Analytics
Cloudflare Web Analytics is a free web analyzing tool. It is privacy first and has the following features.
- It doesn’t use the client-side state such as cookies and localStorage.
- It doesn’t use the “fingerprint”.
I also integrated it easily into my site.
How to adapt it
Follow the steps below to add Cloudflare Web Analytics to your website.
- Remove old analytics tools if you have used them.
- Add your website to Cloudflare.
Remove Old Tools
This website used Google Analytics. I also use the SEO plugin, which supports GA, and I entered the tracking code into the plugin. I cleared it and turned off the plugin.
Add the Website
Add the website to the Web Analytics. You can add any sites, including those that do not use Cloudflare.
For example, the hostname is
www.rk-k.com for this site. If you enter a site that is not registered with Cloudflare, the message “Click here to use www.rk-k.com which does not belonged to Cloudflare websites” will appear. Then click it.
Insert the Code
Insert the copied code before the ending of the
body tag. This website uses the “SWELL” theme of WordPress, so I introduce the method for this theme.
About the Traffic Analytics Tool
For more about Cloudflare Web Analytics, see the official website.
Disconnect the Linked Services (Applications)
One of my websites uses Google AdSense, and my AdSense account is linked to Google Analytics. Surprisingly, Google Analytics continued to receive metrics from that site even after I removed the GA tracking code. I am still trying to figure out the reason. The reason may be cache. The cache containing the tracking code may still be alive.
Clear the Cache
This site uses two caches: SWELL built-in cache and Cloudflare cache. These caches contain tracking codes, so I need to purge them.
Clear the SWELL Contents Cache
To clear the SWELL contents cache, follow the steps below.
Clear the Cloudflare Cache
My site uses the Cloudflare plugin for WordPress. It can purge the cache. Follow the steps below.
Cloudflare Web Analytics is more straightforward than Google Analytics.
However, I can see the page views, the visitors count, the countries of visitors, etc. I can also see the page loading time. Cloudflare web analytics removes the metrics of the bot.
It quickly and frequently updates the data. It updates the metrics of new visitors in a few minutes.