2

We've been troubleshooting our site's performance in China. We've removed a lot of the scripts that were slowing pages down.

Two critical things we can't simply remove are Google Analytics and Google Tag Manager.

We know that both scripts seem to be blocked some of the time, since we can still see traffic in Analytics.

Does anybody have best practices for how to deal with China blocking these types of services, or for performance in general?

6 Answers 6

1

You could create a china-version of Your theme (if site has one, like Wordpress themes for example). And set this theme only for China users (by IP for example). And this theme must be without any blocked js like GA. Users from another countries will receive a main theme. This helps You customise this theme for China users a lot.

1

Hosting

Theres many ways you can approach hosting when serving the website across the globe as fast as possible, each with there own pros and cons.

  • Load balancers: some hosting providers offer good load balancers that can also be used for geo targetting as well as ensuring that if your website would to get overwhelmed it would balance it across multiple servers in the same country.
  • GEO targetting: Using PHP, ASAP, JS or any other powerful web programming language you can detect where a user is in the world and then redirect to a sub folder, hosted on another server using either a sub domain redirect or a sub folder using a reverse proxy. Because IP's are sold in blocks they often get moved around a lot and because of this you will want reliable and up to date GEO information, I recommend using Maxmind.
  • Cloud hosting: Most likely one of the best methods would to be use reliable, fast and secure cloud hosting to serve the website. Serving your website on a cloud has many benefits and a lot of clouds nowadays have nodes in multiple countries around the world. Some cloud hosting supports similar features found in most Content Delivery Networks that will always serve the data to the nearest client. So if the cloud hosting supports this feature and uses data centers in china and all the other locations you need then this would be possibly the best solution.

Analytics & Tag Manager

Sadly, as you know a lot of services by Google and other major online companies are blocked. Simply looking to get around this problem using tricks will most likely break the terms and conditions enforced by Google. Your only option would be to look at services that are not blocked, these can be western tools that are allowed or host your own Analytics using something like PiWik. You will however need to ensure that your website is compliance with China internet regulations and law, because they could block your entrie website and then your in a worst position.

In regards of Google tag manager you will also need to look for a compatible service that is allowed, I don't know a lot about tag manger but often what Google offers someone else does too. Again you will need to find a western supported service or make your own web app that does so.

1

If you have not already I would suggest that you should compress all your files on server? It is pretty easy to do and it will give you that edge on your loading time of the website and so it will help speed things up. Take this code and out it into your .htaccess

AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascrip

0

host your content with companies that has server in China or near. I think AWS launched their service to China not long ago.

1
  • With respect. This does not answer the question concerning Google Analytics or Tag Manager code being blocked. Do you have recommendations in that regard?? Thanks in advance!!
    – closetnoc
    Mar 31, 2015 at 23:48
0

If China blocks the scripts/services then don't waste your time with it trying to make workarounds, just leave it in and move on to something that isnt a waste of time...something that converts. Its akin to supporting IE 6-7-8 (Remember those days? Double investment, almost no gains, no rewards). Its a dead horse Jim and all of the other websites as well as the citizens are already beating it for you.

As far as performance goes, caching, minification, compression, and consolidation could help a lot. The killer for slow net is not the throughput, but the connections required to retrieve all the assets. This is compounded on SSL mode because of extra handshakes (makes timeouts). Making assets small and rendered in as few requests as possible will help immensely. Too many requests will force users on net such as 2G speed to request your page 2-3 times before its legible. It could get nasty too -- on recent Chromes for example, if a timeout occurs it will often corrupt out or half bake cache items. This includes scripts which is very much annoying when one half downloads and wont re-download. Most people dont know how to clear+hard refresh to fix it so they think your site is broke.

So some ideas for reducing those connection requests: Change all possible raster media to CSS, SVG, or font-icons. Combine all your stylesheets into 1 or 2 files. Combine all your jQuery plugins into 1 file. Make all script calls to js files "async". Convert as many scripts as possible to below the fold inline style. Try lazy loading long lists of media. Add a performance enhancing middleware such as mod_pagespeed.

As far as byte speed, Cloudflare has a free plan that includes some cool stuff dealing with the above performance boosters. Minifier is nice, Rocketloader is sometimes buggy but nice too. Threat control is cool, you will need it since 60% of China traffic are crap bots. They also have Hong Kong and Seoul datacenters which is pretty darn close to China. https://www.cloudflare.com/network-map

0

Let me list the major three issues based on the expert reviews we conducted on Chinese websites made by western businesses.

  1. Locate better hosting that is suitable for China's market.

  2. Western Social Functionality: Facebook, Google Plus, Twitter
    Limit or completely eliminate the use of externally pointing social functionality with Facebook, Google Plus, Twitter, etc. These sites had been blocked in China. If you are using their functionality, on the one hand, it will make your site difficult to use and the speed will be slowed down a lot, on the other hand, it will even put your website in danger of possible block.

  3. Make the website simple and light Loading Time ✓ Whether the load time for site pages is optimized? Make sure you optimized: Scripts across web pages. Images across web pages. CSS across web pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.