How to Use Google Analytics in China

in #china7 years ago

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.

ga-track.jpg

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…

ga-query-params.jpg

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.

ga-doubleclick.jpg

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.

ga-canada-test.jpg

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 .

ga-china-test1.jpg

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).

ga-settings.jpg

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.

Sort:  

@digij
Nice writeup
Good job
Keep it up.

Thanks!