Baidu Tongji 2026: The Ultimate Guide to China's Analytics Powerhouse

Baidu Tongji (百度统计) is the gateway to understanding your Chinese audience. This guide covers setup, metric comparisons with Google Analytics, advanced troubleshooting, and the hidden gotchas every Western marketer must know.

Jump to Quick Checklist
Baidu Tongji analytics dashboard showing visitor trends, source breakdown, and real-time data

Baidu Tongji (百度统计) is the dominant web analytics platform in China, used by over 12.9 million websites worldwide—including 2.6 million in the United States. It's not just a "Chinese Google Analytics"; it's a fundamentally different tool designed for China's unique digital ecosystem. For anyone serious about Baidu SEO, installing Tongji is non‑negotiable.

Western marketers, take note: The interface is in Chinese, but modern browser translation tools handle it surprisingly well. For a smoother experience, install the Baidu Tongji Helper extension, which provides English overlays and real‑time validation.

Why Baidu Tongji? Six Reasons It's Essential

Reason What It Means for You
True keyword visibility Unlike Google Analytics (which hides >95% of keyword data), Tongji shows the exact search terms users typed in Baidu—invaluable for SEO.
China‑specific dimensions See visitor ISP (China Telecom, Unicom, etc.), precise geographic region down to city, and network type (Wi‑Fi, 4G, 5G).
Direct Baidu ecosystem integration Data flows seamlessly into Baidu Webmaster Tools (Ziyuan) and Baidu Ads, enabling closed‑loop optimization.
Mobile‑first by design Captures app and Mini Program data natively, with an SDK for native iOS/Android tracking.
Free and powerful Core features are completely free, including real‑time monitoring, event tracking, and heatmaps (with limits).
Compliance built‑in Supports IP masking, data retention controls, and PIPL/GDPR compliance modes—critical for legal operation in China.

Step‑by‑Step Setup (With Chinese Phone Number Workarounds)

1. Account Registration – The First Hurdle

Baidu requires a Chinese mobile number for SMS verification. If you don't have one:

  • Work with a local partner or agency to facilitate.
  • Use a virtual Chinese number service (risky; may be blocked).
  • Register via Baidu Ads if you're a paying advertiser.

Once you have a number, visit tongji.baidu.com, log in with your Baidu account, and complete the SMS verification.

2. Adding Your Website (Critical Details)

After login, go to Manage → Website List → Add Website. Pay attention to:

  • URL protocol: Include https:// or http:// exactly as your site uses. https://www.example.com and http://example.com are treated as different sites.
  • Domain granularity: www.example.com and example.com are separate. If both resolve, add each as a distinct site.
  • Site type: For responsive sites, choose "PC站" (PC site) – there's no dedicated "responsive" type yet. The wrong selection can break mobile event reporting.

3. Obtaining and Placing the Tracking Code

After submitting, you'll receive a JavaScript snippet similar to this:

<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?xxxxxxxxxxxxxxxxxxxx";
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(hm, s);
})();
</script>

Placement rules (non‑negotiable):

  • Insert the code inside the <head> tag, as high as possible—ideally the first script. Placing it in the <body> can miss up to 62% of first‑screen views.
  • Do not add async or defer attributes; they break the initialization queue.
  • The code must appear on every page you want to track.

Platform‑Specific Deployment

  • Static HTML: Paste into each .html file.
  • WordPress: Use a plugin like "Insert Headers and Footers" – paste in the "Scripts in Header" section. Avoid editing header.php directly (theme updates will wipe it).
  • Typecho / other PHP CMS: Edit the theme’s header.php and place before </head>.
  • SaaS platforms (Wix, 凡科, etc.): Look for a "Custom Code" or "Header Code" section in settings.
HTTPS & CSP note: If your site uses a Content Security Policy, you must allow https://hm.baidu.com and https://bdstatic.com. Add to your CSP header: script-src https://hm.baidu.com https://bdstatic.com.

Verifying Your Installation (Don't Skip!)

Method 1: Real‑time Visitor Check

In Tongji, go to Real‑time → Real‑time Visitors. Open your site in an incognito window and refresh. Within 10–30 seconds, you should see yourself appear. If not, the code isn't firing.

Method 2: Browser Developer Tools

  1. Open your site and press F12 → Network tab.
  2. Filter by hm.baidu.com.
  3. Refresh the page. You should see requests to hm.js?xxx. If nothing appears, the script isn't loaded.

Method 3: View Page Source

Right‑click → View Page Source, then search for hm.baidu. Confirm the code exists and is not commented out.

Method 4: Console Log (Advanced)

Open the console and look for [BaiduTongji] Loaded successfully. If you see this, the script is active.

The 72‑Hour Validation Rule

After installation, wait 72 hours and export a "Trend Analysis" report. Compare the three days before and after install. You should see a stable upward curve (not a drop to zero). If data is flat, something is broken.

Baidu Tongji vs Google Analytics: Key Differences

Dimension Baidu Tongji Google Analytics (Universal/GA4)
Search keyword data Full visibility – shows exact queries from Baidu search. "Not provided" for >95% of organic traffic.
Geographic detail (China) City‑level data, plus ISP and network type (e.g., "China Mobile 4G"). Limited to "China" with poor accuracy due to VPN/proxy usage.
Ecosystem integration Native links to Baidu Webmaster Tools, Baidu Ads, and Baidu Maps. Integrates with Google products (Search Console, Ads, etc.).
Data freshness Real‑time updates (seconds delay). GA4 real‑time is limited to last 30 minutes.
Mobile app tracking Dedicated SDK for iOS/Android (Baidu Mobile Tongji). Firebase SDK required.
Sampling Free tier includes unsampled data for up to 5 million PV/day. Free GA4 may sample data in reports.
Heatmaps Built‑in (basic) for free. Requires third‑party integration (Hotjar, etc.).

Bottom line: Tongji is irreplaceable for understanding Chinese user behavior. Use it alongside GA, not instead of it.

Advanced Configuration: Events, Goals & Exclusions

Setting Up Event Tracking

To track button clicks, form submissions, or video plays, use the _hmt.push() API:

// Track a click on a "Download" button
document.getElementById('download-btn').addEventListener('click', function() {
  _hmt.push(['_trackEvent', 'Downloads', 'Click', 'Whitepaper.pdf']);
});

Parameters: _trackEvent, category (string), action (string), optional label (string), optional value (integer). Events appear in Tongji under "Conversion → Events".

Creating Conversion Goals

Go to Manage → Goal Settings → New Goal. You can define:

  • Pageview goal: User visits a specific URL (e.g., /thank-you.html).
  • Event goal: User triggers a specific event (e.g., "Add to Cart" click).
  • Duration goal: User stays on site > X minutes.
  • Pages/visit goal: User views at least X pages.

Excluding Internal Traffic

To prevent your own visits from skewing data, go to Manage → Exclusion Settings → IP Exclusions. Add your office IP(s). You can also exclude by cookie (useful for remote teams).

Mobile App Tracking with Baidu Mobile Tongji

For native apps (iOS/Android), use the Baidu Mobile Tongji SDK. Integration steps:

  1. Create an app in the Tongji web interface (get your App Key).
  2. Add the SDK via CocoaPods (iOS) or Gradle (Android).
  3. Initialize in your main activity/AppDelegate with the App Key.
  4. Manually track screen views and custom events (auto‑tracking is limited).

The SDK supports offline caching, crash analysis, and user profiling.

Troubleshooting: The 6 Silent Killers of Baidu Tongji Data

Issue Diagnosis Fix
Code placed in wrong location View source: code appears after other scripts or in <body>. Move to top of <head>.
Domain mismatch You added example.com but your site is accessed via www.example.com. Add both as separate sites, or redirect to canonical domain.
CDN caching the tracking code curl -I yourdomain.com shows an Age header >0 (stale). Purge CDN cache; ensure the HTML is not cached for too long.
Ad blockers / privacy extensions Data drops correlate with uBlock Origin usage. Enable "Anti‑adblock compatibility" in Tongji settings (under Manage → Advanced).
Multiple copies of the code document.querySelectorAll('script[src*="hm.baidu"]').length returns >1. Remove duplicates from your theme, plugins, or tag managers.
CSP blocking requests Console shows "Refused to load script" errors. Update CSP to allow hm.baidu.com and bdstatic.com.

Quick Diagnostic Script

Open your browser console and run:

// Check if code is present
console.log('Tongji script count:', document.querySelectorAll('script[src*="hm.baidu"]').length);
// Check for network requests (requires Network tab open)
console.log('To verify network requests, filter by "hm.baidu" in Network tab.');

Linking Baidu Tongji with Baidu Webmaster Tools (Ziyuan)

This integration unlocks powerful SEO insights:

  1. In Baidu Webmaster Tools, go to Settings → Associate Baidu Tongji.
  2. Select the verified site and the corresponding Tongji account.
  3. Once linked, you'll see click‑through rates, average position, and exact keyword performance directly in Tongji reports.

This is the only way to get Baidu search query data at scale.

Key Metrics to Monitor in 2026

  • Search engine traffic share: What percentage comes from Baidu vs other engines (Sogou, 360, Shenma)?
  • Keyword rankings (linked with Webmaster Tools): Which terms drive clicks? Track changes weekly.
  • Visitor geography: Are you strong in tier‑1 cities but weak in tier‑2? Adjust content accordingly.
  • Mobile vs desktop split: If below 70% mobile, your site may not be mobile‑optimized.
  • Bounce rate by source: High bounce from Baidu? The page may not match search intent.
  • Event completion: Monitor micro‑conversions like "Add to Cart" or "Play Video".

Quick Checklist: Baidu Tongji Mastery

  • Account registered with Chinese mobile number (or partner).
  • Site added with exact URL (protocol and www/non‑www correct).
  • Tracking code placed in <head>, top of every page.
  • HTTPS and CSP configured to allow hm.baidu.com.
  • Real‑time test confirms data flow.
  • Internal IPs excluded to avoid self‑pollution.
  • Key events tracked with _hmt.push.
  • Goals set for conversions (thank‑you page, form submits).
  • Linked with Baidu Webmaster Tools for keyword data.
  • Mobile app SDK installed (if applicable).
  • Monthly audit of silent failures (CDN, CSP, duplicate code).
Remember: Baidu Tongji is your compass in the Chinese digital landscape. Use it weekly, dig into the search query reports, and let the data guide your content and technical decisions. The insights you gain here are simply not available in any Western tool.