Skip navigation

Here's How to Get Google Analytics to Work in China

Paul Shope - The C2 Group

The C2 Group

Medium China100

As opportunities have come to work with international clients, we’ve tackled many challenges – far too many for one post. In 2017, one of our clients wanted to build an intranet tailored to their Chinese operations and hosted in China. As one of their requests, they asked C2 to add Google Analytics to the China site to which we said, “No problem!”

Actually, that’s not true. We had already found limitations on other Google services in China. In 2006, Google started offering China limited services due to their strict censorship laws. A cyberattack in 2010, however, prompted Google to reverse its position and offer unfiltered services in China, knowing the inevitable outcome. Within months, China began blocking Google search, followed later by Gmail and other services (Youtube, Google+, Google Hangouts, Google Drive, Google Calendar, etc).

With these crucial details in mind, we held our breath and said, “challenge accepted”, and started our research.

We used the latest process available via the Google Analytics Console and applied Google Tag Manager to the site. We were not too surprised when that didn’t work, as Tag Manager appeared to be blocked based on how China has their firewall set up. Unwilling to give up, however, we looked for solutions and found a helpful article provided by Grizzly Panda Marketing, conveniently titled “How to Use Google Analytics in China.” This gave us some helpful information and hope. Grizzly Panda suggested using Google Analytics over other common analytics services such as DoubleClick, Google Remarketing, Advance Audience Report, and Google Tag Manager simply because these are very slow to load in China. After trying to set things up as directed by the article, however, we were still getting no data.

We then noticed that the latest tracking snippet (provided by our Google Analytics account, under Admin > Tracking Info > Tracking Code) was different than the GA snippet we were used to. It starts like this:

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>

What was all this about “googletagmanager”? Did we have the right code? After further investigation, we discovered that Google had changed their default GA snippet since Grizzly Panda Marketing published their article. The new snippet uses Google’s “Global Site Tag” framework which is JavaScript tagging framework and API that allows you to send event data to Google Analytics, AdWords, and Doubleclick. While we appreciate Google’s drive to make things better, we were trying to avoid GTM! We needed the previous method which uses "analytics.js" for ‘basic reporting needs’, and fortunately for all of us, Google is still providing it.

We used a roundabout way to find info about “analytics.js”, but we’re happy to save others that trouble.

We copied the alternate script, entered our tracking ID in the “create” call, and we started getting data from the China site. Another happy client!

Despite the block on most Google services, Google Analytics remains one of the most effective solutions available. Many thanks to Grizzly Panda Marketing for their article and to Google for still offering analytics.js, but in the ever-changing political landscape of Google and China nothing is certain. If Google Analytics becomes blocked in China, we will all be looking for an alternative.