Setup Google Analytics in China

User insights, tracking and monitoring with Google Analytics in China. Yes, it does work behind the firewall

If you have Chinese website visitors or just want to find out how many people are visiting your site from China, you might wonder whether Google Analytics actually works in China.

You might ask: Am I able to get reliable statistics on user counts, page views and even location? You might have heard that Google is blocked in China - that’s right - but is Google Analytics affected by that? Let’s dive into it.

Google Analytics is the most obvious choice for website analytics, especially for those with a limited budget, which is why we found ourselves in the position of setting up the tool for a client with a large Chinese user base.

The tricks of user tracking and Google Analytics for China

You might have heard that any website which servers are outside of China are slow for Chinese users to access. Well, that’s right, but not every user in China is experiencing the same troubles. That is because in China, the internet works differently in different regions and with different providers, which makes fixing a slow website very hard.

In addition to regional differences, we have experienced that troubles change over time. Therefore we first recommend our clients to test their specific setup (more on how to do that, below) and second, to setup continuous supervision of website speed and accessibility.

Now the positive message: Google Analytics makes it very easy to continuously monitor your site and find out when specific groups of users (e.g. Chinese users from the region of Guangdong) experience a high latency.

How to set up Google Analytics in China

You might find older articles on the internet about how to set up GA in China. Some are advicing to use one specific method of setting it up (i.e. via analytics.js). However, we found that both analytics.js as well as gtag.js worked for our client. Our tip: Start with one of both and track if it works for you and use your monitoring to make sure that the solution keeps working.

Start by measuring website speed for Chinese users

Before installing Google analytics, you need to map your current site speed for Chinese users. Why is this important? You would want to set a benchmark to measure against, after having set up GA. When speeds keep the same, your setup works!

We are using the following tools to test our speed.

17CE is a company based in Shanghai that offers website speed and real-time monitoring. Enter your website’s address at and click ‘Check it’. Hint: We suggest translating the site via e.g. Google translate.

After loading, you will find a map that indicates speeds from different servers located in different parts of China. Below, 17CE offers a list of specific servers actually showing their corresponding internet service providers (ISPs).


For advanced users, the tool also shows ping, traceroute and other information, that might help you to analyze further speed issues for Chinese users.

We suggest, you don’t take those results too seriously. Having red points on that map might indicate a slow website for some Chinese users, but won’t give us any details, for now. Let’s get into those below.

Alternative tools

Similar, but harder to understand:

Easier to understand, but not as many servers:

Setting up Google Anlytic’s analtytics.js on your website

Setting up Google Analytics on your site is free. Some website builder tools will integrate it for you. For everybody else, the setup requires a minimal knowledge of website code. If you get stuck on this point, feel free to reach out to us.

After registering your Google Analytics account, the tool will show you a code snippet to insert into your website’s html code. As mentioned, Google Analytics has several methods to do that and we suggest using their analytics.js setup as it has proven to work for China with our client’s >200k monthly-page-view landing page.

Google Analytics will also forward you to their how-to on integration here, which we suggest to follow. In short, you add your tag (including your personal UA-XXXXX-Y) to the top of the <head> tag of your website - and each subsite - and you're done.

Google Analytics will start showing you website visitors after the setup is correctly implemented.

Test again

Now we should make sure that the site is still as fast for Chinese users as before. Simply running through all metrics as before and comparing any difference should surface any further issues.

Setup the right speed monitoring in Google Analytics

We just verified that your site is still running fast for Chinese users even after setting up Google Analytics. As mentioned above, we have noticed that the situation can change for Chinese users, or at least for a region or carrier/ISP. Luckily, Google Analytics allows us to set up alerts for various metrics, such as changes in page speed or conversion rate. Let’s go through an example below.

To set up an email alert, open your Google Analytics and enter Customization and Custom Alerts and Manage custom alerts.


After clicking New Alert, we enter - as an example - an alert to notify us if the average page load time for users from China increases by 30% over 2 consecutive days.


Try the same with Bounce Rate or Session Duration. We suggest you play around with metrics and gradually adjust them to meet your needs.

If you have more questions feel free to reach out to us at!

Google Analytics in China, in short:

Follow these three steps

Check site speed

Visit and click ‘Check it’.

Install analytics

Install analytics via analytics.js.

Set up monitoring

Enter gAnalytics and add Custom Alerts.