How to Use Google Analytics in China

Let me guess…

You’re reading this because you’re building or operating a website cater to Chinese users currently living in China, and you want to track the traffic but you don’t know what to use because you believe that Google Analytics is blocked in China.

To be fair you’re partially right. And traffic tracking in China is a big problem for many of us. There are other traffic tracking tools but none as robust as Google Analytics, at least not for free.

So, naturally you would want to use Google Analytics if you can, but you think it is blocked by the great firewall of China.

The Myth of Google Analytics in China

Unless you’ve been living under a rock for the past 10 years, you would know that the biggest search engine in China is not Google but Baidu. Google is restricted in China, and even with Google’s recent attempts to work with the Chinese government to bring Google back into China, most of the Google-related products are simply inaccessible to the 1.3 billion internet users in China right now.

However, there are a few expectations…

While many people believe that since Google is inaccessible in China, then anything hosted or related to Google is inaccessible in China. And since GA is owned and run by Google, it is only logical to assume that GA doesn’t work in China.

And this is partially true, but not entirely

Contrary to popular beliefs as of today, May 2017, Google Analytics does actually work in China or at least partially anyway…

To give credit where credit is due, this finding is actually discovered by seoshifu. While we love their post, but we were somewhat skeptical. So, we decided to run a few tests to see if Google Analytics will, in fact, work in China.

But before we show you our test results, it is important for you to understand…

How Google Analytics Actually Work

If you’ve ever worked with Google Analytics outside of China, you know that in order to install GA on your website you must first sign up for a Google Analytics account, and then copy and paste a short snippet of JavaScript code in the header section of the web pages that you want to track. After that, you might just assume that it all just works like magic.

I hate to break it to you… but there is nothing magical about how GA actually work. In fact, it is pretty simple…

Every time a user visits your website. The GA JavaScript Code is triggered and downloads the actual Google Analytic JavaScript (analytics.js) library that does the tracking of your website traffic from gooogle-anayltics.com.

Once the library is downloaded it will automatically begin to collect some key information from the user. Then GA pixels the user by sending a request to https://www.google-analytics.com/r/collect

This request is actually a request to download a 1-pixel gif image called __utm.gif. The reason why the request is made for 1 pixel is because 1-pixel gif image is the smallest unit of bytes that can be returned from the server. And since a typical HTTP request must return something, it only makes sense to return the smallest possible unit of bytes.

At this point, you may be wondering… how exactly does Google get all the information they display on Google Analytics console.

Well, the gif image is actually requested every time a page view, transaction or event is being triggered. And along with this request are the query parameters that contains all the information of the user and a typical GA query parament looks like this…

All the information of the user is being sent to Google using these query parameters, and then process by the Google Analytics server to be displayed on your console. In fact, this is exactly how Facebook pixel works too and this is why it’s called a Facebook pixel.

So far so good?

Cool, up till this point, GA works pretty well and fast in China. What this means is that, since google-anayltics.com is not blocked by the great firewall of China, at least as of today. Running Google Analytics barebone like this will work 100% even in China and you should be able to track your website traffic in China.

However, the problem comes when you mix in AdWords Remarketing and Advance Audience Insight into the equation

DoubleClick, Remarketing and Audience Insight

If you or your business have ever paid for advertisement on the internet, chances are you or someone on your team has most likely turned on Google Remarketing and Advance Audience Report.

If these options are turned on, then Google Analytics will make 3 additional requests on top of the one we mentioned previously. Although these 3 additional requests are also requesting for a 1-pixel gif image, but it is requesting from 2 different servers, stats.g.doubleclick.net. and google.com/pagead/ga-audiences.

These 2 servers are also not blocked by the great firewall of China, but they do have a slow response time which will cause your website to load slower. So, if you have these two options turned on in your Google Analytics’ admin settings then it will cause your website to load slowly in China.

Our Testing Results

To setup this test we’ve created a single bare bone web page that consists only the Google Analytics Code. This is so that no other JavaScript libraries or style sheet will affect our test results to see how fast Google Analytics loads in China.

We first ran a speed test in Toronto Canada, just to see how fast GA is outside of China.

As you can see all 4 requests, including ga-audiences and stats.g.doubleclick responded under 100ms (millisecond) with standard GA request being slightly faster with a respond time of 39ms. Then we ran the same test in China .

The test results in China were slightly slower, but event though one of the ga-audiences had a 300ms respond time, overall it is actually not that bad. You have to consider the connection is coming all the way from China and it will definitely be slower.

From the test result, we can see the standard GA request had a respond time of only 63ms and all 4 requests were not blocked by the great firewall of China. So, it is safe to conclude that Google Analytics is definitely usable in China.

How to Make Google Analytics Work in China

If you have just created a new Google Analytics Account and have not fiddled around with different admin settings then good, leave them alone. Google Analytics will actually work straight out of the box if you don’t change any settings.

On the other hand, if you’ve been running Google Analytics for a while and you’ve been working with AdWords and remarketing then all you have to do is make sure that both Google Remarketing and Advance Audience Report are turned off (see screenshot).

Optionally, if you have a linked AdWords account it is ideal for you to disconnect this account just to be sure that double click will not be trigger by your GA code on your website.

Google Analytics Console

Unfortunately, Google Analytics Console is completely blocked in China, and the only way you can access the console is to use some third part VPN.

Google Tag Manager

For those of you that are using Google Tag Manager to manage your GA code, we recommend you do not use it in China as it is very slow.

Our Recommendation

Although, it is possible to turn off double click and google audience from being triggered. It is ideal to completely create a separate Google Analytics account just for your Chinese website. Doing this will allow you to continue to operate your global website with remarketing turned on, and will give you a more clear and accurate view of your China traffic.

Recap

To recap, as of today May 2017 the tracking code part of Google Analytics works very well in China if you do not turn on Adwords Remarketing and Advance Audience Report. Google Analytics console is however completely inaccessible in China and will require a VPN to access.

So… that’s it for our little experiment on Google Analytics in China, we sincerely hope you find this useful. Also, feedbacks are always appreciated so please leave us a comment with your ideas and thoughts.

Do you want to sell your product or services to Chinese consumers?

At Simplify our mission is to help consumer-facing business and brand reach more Chinese consumers. My only question is, will it be yours?

Book Free Strategy Session

Comments (11)

Hello there,
Nice article,
For us, we observe that ga-audiences script (hosted on the blocked google.com domain) seems definitely blocked from China (analytics.js et collect still work)
Best

Hey Nicolas,

Yes the Ga Audiences are blocked, you’ll have to disable them in your settings.

Hi! Thanks for sharing. Lots of valuable tips. Though it seems like requiring much effort and it’s a bit tricky. There are other ways to handle web tracking in China which let you stay in line with legal requirements like storing data on your own servers in China. Here you can find some more information: https://piwik.pro/blog/overcome-data-loss-and-latency-in-china/

Thanks for sharing

A question regarding the use of GTM.
Google Tag Manager

“For those of you that are using Google Tag Manager to manage your GA code, we recommend you do not use it in China as it is very slow”

Slow? Page load slow for the user of the website or slow at collecting the tracking data?

Thanks.

Hi Michael,

Your website will load very slowly in China which will lower your chance of ranking on Baidu as well 🙂

Hi Michael,

if you think about how a website is loaded regardless where it is. The user go to your website which triggers the browser to fit the information on your server. Then the browser read the page line by line (HTML) and when it reads the Google tag manager script tag it goes and fetches the script from Google’s server which in banned in China causing it to slow your site down.

You can async the fetch but it’s kind of point less but it won’t load Tag Manager properly most of the time in China anyway.

Hi, I came across this post through many other posts/threads that lead to this originating post… but we’ve successfully used GTM for 2 years within China and the analytics metrics jive with what we see actually coming through on our servers for the most part. Right at this very moment I did notice from within China that GTM was being blocked via browser which was at first concerning…. but then after 45 mins, I noticed GTM did NOT get blocked but browser tried upon loading http://www.google-analytics.com/analytics.js next (since GTM got through) it FAILED! So my conclusion is any of Google’s addresses can be intermittently blocked.

I even tried testing https://www.google-analytics.com with various online China Firewall test tools and it failed.

As I said using GTM with no real issues within China, servers in China, targeting Chinese audience for 2 years.

Thanks for sharing

Hi Steve,

We tried setting up the Google Analytics code like that on a specific site that we run in China but no data comes up. We created a new property in Analytics with a new email with no linking to Google Ads and no Audience.

Is there a problem with the mention of tag manager with the new scripts that are provided by Google Analytics (we didn’t implement the tag through tag manager). The new Analytics codes have a GTM mention and I don’t know if it is an issue. Would you have a website that we can look at? that could be a great addition to your text by the way 😉

New script with GTM

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());

gtag(‘config’, ‘UA-ABCDEFGH-1’);

Yes, Google seem to run everything through GTM (tag manager now). And honestly we’ve not tested it as we usually just use other analytics

Leave a comment

Sending...
Are you looking to sell your product or services to Chinese consumers?

Book a free 30 minutes strategy session to see if we can help you sell more to Chinese consumers worldwide.

Yes, Let's Talk No, Maybe Later
0 Shares
Share via
Copy link
Powered by Social Snap