China Localized Service Stack for Global Sites

China Localized Service Stack for Global Sites

Google-dependent widgets can fail on the mainland, a working hypothesis rather than a documented rule. This is the replacement stack — maps, fonts, analytics, video, WeChat — behind one locale-keyed abstraction, not a fork.

A China-facing site should plan a mainland equivalent for each Google-dependent third-party widget — Maps, Fonts, Analytics, Tag Manager, reCAPTCHA, and YouTube — because this guide's working hypothesis, not a documented rule, is that they can fail to load on the mainland. It should also design WeChat as the primary social and contact surface rather than Western share buttons. A high-leverage fix is self-hosting fonts and static assets, with CJK fonts subset to the glyphs the site uses. This guide gives you an inventory of services at risk on the mainland, the map, analytics, video, and contact replacements, and a locale-keyed service-abstraction layer so China swaps providers without forking the codebase.

The at-risk service inventory

Before designing any replacement, audit what actually fails. A working hypothesis, not a documented rule, is that these can fail on the mainland: Google Maps and its Places and Geocoding APIs, Google Fonts, Google Analytics 4, Google Tag Manager, Google reCAPTCHA, and YouTube embeds. When a request to one of them never resolves, the result is not just a degraded experience — the dependency can block rendering or break a function.

The audit has to cover transitive dependencies, not just the obvious embeds. A component library that pulls a webfont from a Google endpoint, an analytics wrapper that loads a tag-manager container, or a form library that ships reCAPTCHA by default all reintroduce the failure even when no one consciously added Google to the page. The goal of the audit is a single statement: zero hard dependency on a provider that, on the working hypothesis above, may be blocked or throttled on the mainland.

The reliable way to find these is to inventory outbound requests rather than to read the source. A list of every domain the page connects to, taken from the network panel and cross-checked against your list of services at risk on the mainland, surfaces the font CDN a design system pulls in and the telemetry endpoint a third-party widget calls home to — dependencies that grepping the codebase for "google" will miss because they are one library deep. Run that inventory per template, not once for the homepage, because a checkout or a contact page often loads providers the marketing pages never touch. The table records the failure modes as a working hypothesis, not a documented rule; confirm each row from a mainland vantage.

Possibly blocked or unreliable (working hypothesis)Failure modeMainland replacement
Google Maps / Places / GeocodingMap tiles and geocoding may not loadAMap (Gaode) or Baidu Maps
Google FontsRender-blocking font request can hangSelf-hosted, subset web fonts
Google Analytics 4Data may not reach GA4Baidu Tongji or a local provider
Google Tag ManagerContainer may not load, so dependent tags failLocally hosted or proxied tag setup
Google reCAPTCHAChallenge served from www.google.com may not render, blocking formswww.recaptcha.net (test from the mainland first), or a local or self-hostable CAPTCHA
YouTube embedsPlayer may not loadYouku, Bilibili, Tencent Video, or self-hosted

Treat the inventory as the contract for the China locale: every row needs a decided replacement before launch, not a fallback discovered in production.

Maps — AMap and Baidu Maps

Mainland map providers include AMap, also marketed as Gaode, Baidu Maps, and Tencent Location Service; this article uses AMap and Baidu Maps as the worked examples. AMap and Baidu Maps both expose developer platforms — the AMap developer platform and the Baidu Maps developer platform — with their own software development kits, tile servers, and licensing models. A store locator or directions feature is rebuilt against the chosen local SDK, not skinned: the API surface, the marker model, and the event handling differ enough that a thin wrapper over the Google API does not transfer.

The non-obvious trap is the coordinate system. AMap's documentation describes GCJ-02, the coordinate system AMap's coordinates belong to, as one used within China that has been mandatorily encrypted; Baidu adds a further BD-09 offset on top of it; and GPS devices and global map services such as Google Maps commonly use WGS-84. China's Ministry of Natural Resources specification for representing the content of public maps, dated February 6, 2023 and valid for five years from issuance, does not name GCJ-02; it requires that a map compiled from surveying and mapping results involving state secrets be processed, in accordance with the law, with confidentiality-processing technology approved by the competent authorities. For public maps or products carrying map graphics that depict places within China, the same specification requires plane accuracy coarser than 10 meters and elevation accuracy coarser than 15 meters, with contour intervals greater than 20 meters, although elevation points published in accordance with the law may be shown; nautical charts follow separate rules. Plotting raw WGS-84 coordinates on a mainland map places markers off their true position. Store and process coordinates with explicit awareness of which datum each value is in, and convert at the boundary rather than mixing systems silently — a single un-converted latitude can move a store pin off the building it belongs to.

The coordinate problem extends past display into the input path. Address entry, geocoding, and reverse-geocoding all run through the local provider's coordinate system, so a "find nearest store" feature that geocodes a user's typed address against one datum and measures distance against store coordinates stored in another returns confidently wrong results — the bug is silent because every number looks plausible. The discipline is to treat the datum as part of the coordinate's type, convert once at the system boundary, and never let a raw global-datum value reach a mainland map call.

Choosing the global provider matrix for every other market — Naver and Kakao in Korea, Yandex in Russia — is a separate decision with its own trade-offs; the maps-by-country article covers that matrix. This article is concerned only with the mainland swap.

Fonts and assets — self-host everything

Google Fonts is an easy China failure to miss, because it can arrive through a stylesheet @import or a copied embed snippet that no one revisits. The fix is unambiguous: self-host the web fonts and serve them from the mainland origin. The web.dev font best-practices guidance covers the loading mechanics — font-display, preloading, and subsetting — that make a self-hosted font fast as well as reliable.

Self-hosting extends to all static assets, not just fonts. As a working hypothesis rather than a documented rule, scripts, stylesheets, and images served from a global edge can be slow or unreachable from the mainland, which is no better than a blocked third party; the China deployment serves its critical assets from the in-country origin or a licensed mainland CDN. This is the same isolated-deployment posture the hosting and filing decision establishes, applied to the asset pipeline.

CJK fonts add a capacity problem the Latin web does not have. A full Chinese font file carries tens of thousands of glyphs and can be several megabytes, so aggressive subsetting to the glyphs the site actually uses is more than an optimization — it can decide whether the page is usable on a slower connection. Asset self-hosting plus CJK subsetting together are a high-leverage China fix, because they remove hard dependencies on offshore font and asset origins.

Analytics and CAPTCHA

A working hypothesis, not a documented rule, is that GA4's collection endpoint may be unreachable from the mainland, so plan a local analytics provider for the China locale. Baidu Tongji is one mainland option and exposes its own analytics platform; the practical consequence is that China reporting lives in a different system from the global one, which the per-locale analytics-and-consent design has to account for rather than assume one global dashboard. A tag manager that calls Google endpoints to bootstrap carries the same risk — replace it or proxy it through the mainland origin so the container and its dependent tags actually load.

reCAPTCHA loaded from www.google.com carries the same risk: if that domain is unreachable, the challenge widget does not render, which silently makes every protected form unsubmittable. Google's reCAPTCHA FAQ says to use www.recaptcha.net in your code when www.google.com is not accessible; test that route from a mainland vantage, or choose a CAPTCHA that resolves on the mainland — a local provider or a self-hostable, privacy-respecting challenge. Settle the choice before launch, because a broken CAPTCHA is invisible in offshore testing and total in-market. The deeper measurement design — consent regimes, attribution, dual-system reporting — is the per-locale analytics-and-consent article's subject; this article stops at naming the working replacements.

Video — Youku, Bilibili, and Tencent Video

A working hypothesis, not a documented rule, is that YouTube embeds do not load on the mainland, so treat any page that depends on a YouTube player for primary content as broken there. Mainland video platforms include Youku, Bilibili, and Tencent Video, and the practical pattern is duplicate uploads: the asset is hosted on a mainland platform for the China locale while the global site keeps YouTube. A self-hosted player serving the file from the mainland origin is the vendor-neutral fallback when a platform account is not viable, at the cost of bandwidth and player maintenance.

The architectural point is that video is per-locale, not global. Swap only the China locale's embed and keep YouTube everywhere else, including Korea where YouTube works normally — the global video-by-country decision is a separate matrix the video-by-country article owns. What this requires in the codebase is a per-locale embed abstraction so the China page resolves to a Youku or Bilibili player and other locales resolve to YouTube from the same component, with the duplicate-upload workflow planned rather than improvised.

WeChat as the primary social and contact surface

On the mainland, WeChat is a central social, identity, and contact channel — Tencent reported 1,439 million combined monthly active users of Weixin and WeChat as of June 30, 2026 (Tencent second-quarter 2026 results) — and designing around Western patterns leaves the China experience hollow. The relevant surfaces are the Official Account, the Mini Program, and the share SDK, documented through the WeChat developer platform. Western share buttons and embedded live-chat widgets add little on the mainland and consume space that the WeChat path should occupy.

A contact path to design for is QR-to-WeChat: a scannable code that opens the brand's Official Account or a Mini Program, rather than an email-first contact form. Designing for this changes the contact page rather than adding a widget — the primary call to action is the QR and the WeChat follow, with email as the secondary path. Treating WeChat as the China contact surface is a design decision made at wireframe time, not a plugin added at the end; the global contact-channel matrix across Korea, Japan, and other messenger-first markets is the messaging-by-country article's subject.

The China service-abstraction layer

The mistake that produces an unmaintainable codebase is a forked China site — a parallel build that drifts from the global one until both are expensive. The pattern that avoids it is a service-abstraction layer: maps, fonts, analytics, CAPTCHA, video, and the share and contact surface each sit behind a provider interface keyed by locale. The China locale selects the mainland implementations; every other locale keeps the global ones; there is one codebase with one set of components and a locale-driven provider resolution.

This makes the China stack a configuration of the global site rather than a separate product. Adding a feature touches the interface once, and both the global and mainland implementations follow from it, instead of two divergent codepaths that have to be remembered in parallel. It also makes the mainland replacements testable in isolation, which matters because the only honest verification is from inside the mainland — an offshore or nearby-region test can reach Google services normally and report a false green.

The verification gap is easy to underestimate when continuous integration runs outside the mainland. A pipeline that passes from a cloud region outside China is testing the global provider path, not the mainland one, so a regression that swaps a mainland map back to Google ships green. The pragmatic mitigations are a synthetic check that exercises the China locale from a mainland vantage on a schedule, and a build-time assertion that the China locale's resolved providers contain no blocked domain — a cheap test that catches a likely regression, a global default leaking back into the China configuration. Build the abstraction first, wire the mainland providers into it, add the leak assertion, and validate the China path from a mainland vantage before launch.

Diagnostic checklist for the next planning cycle

  • Audit every third-party script, font, and embed — including transitive dependencies — for a provider that may be blocked or throttled on the mainland (a working hypothesis, not a documented rule)
  • Self-host and aggressively subset web fonts and serve all static assets from the mainland origin
  • Rebuild maps against AMap or Baidu and handle the GCJ-02 / BD-09 versus WGS-84 coordinate conversion at the boundary
  • Replace GA4 with a local analytics provider, and choose a CAPTCHA route that resolves on the mainland, tested from a mainland vantage
  • Plan duplicate video uploads on a mainland platform behind a per-locale embed abstraction
  • Design WeChat (Official Account, Mini Program, QR-to-contact) as the primary China social and contact surface
  • Put every replacement behind a locale-keyed service-abstraction layer and verify the China path from inside the mainland
Project Inquiry