All Collections
Advanced Topics
Enabling conditional mapping support for China
Enabling conditional mapping support for China

When displaying maps to users in China, you can conditionally use Maptiler instead of Google Maps

Michael Fatica avatar
Written by Michael Fatica
Updated over a week ago

Google has, somewhat famously, backed out of China due to restrictions on search and geographic data publishing. In order to display a functional locator to Chinese visitors, a few settings must be dynamically updated when the visitor's country is detected as China.

  1. Directions links should use Baidu Maps in China. Google Maps functions in China for those outside of China, but not for those within its borders. This template includes conditional logic that displays Baidu for users from CN and the regular Google Maps directions for all others.

2. The Map Vendor should be switched to MapTiler. If the Interface is set to use Google Maps, the Map Vendor should be set to MapTiler GL. This can be done using Dynamic Parameters.

First, enable Dynamic Parameters as shown below:

Then, configure the Map Vendor setting to use maptilergl when geoip_country_code is set to CN by clicking the Dynamic Parameter option next to Map Vendor

Update the values in the Dynamic Parameter Editor as shown below:

Finally, save the Interface for the settings to take effect.


To test the effect of this change outside of China, an IP address can be "forced". To do this,

  1. Preview the Interface to obtain the URL, it will look similar to this example:

  2. Obtain a Chinese IP address by Googling for an example.

  3. Append the preview URL with the following special parameter &_ip=, where the IP address is any known Chinese IP Address. The final URL would be similar to this, but would use your preview link:

  4. You may need to hard-reload when switching back and forth.

Did this answer your question?