Install the tag
The standard install is a single async script before the closing body tag of every page you want to measure. Replace XXXX with the site_id shown on your Manage sites page.
<script async src="https://9ping.dev/hm.min.js" data-sid="XXXX"></script>
If you use Google Tag Manager, create a new Custom HTML tag, paste the same snippet, and set the trigger to All Pages.
For visitors with JavaScript disabled or for email and AMP contexts, add a one-pixel image fallback inside a noscript tag — you will at least capture page views.
<noscript><img src="https://9ping.dev/collect.php?sid=XXXX&type=pv" width="1" height="1" alt=""></noscript>
For single-page apps (React, Vue, Next, Nuxt and friends) inject the script once at boot — the tag automatically counts a virtual page view on every client-side route change.
(function(){var s=document.createElement('script');s.async=true;s.src='https://9ping.dev/hm.min.js';s.dataset.sid='XXXX';document.head.appendChild(s);})();
Custom events
Once the tag has loaded, the global window.tj function is available for ad-hoc events such as button clicks, form submissions and downloads. The signature is category, action, label.
tj('event', 'button', 'click', 'download_whitepaper');
For routers that you control yourself, you can fire an explicit page view by calling tj('pv'). For pre-tag clicks, the early stub queues calls and replays them as soon as the script loads, so you do not need to wrap your handlers in setTimeout.
Verify site ownership
Verification is recommended before you turn on advanced reports. Manage sites lists four interchangeable methods for each site — pick whichever is easiest.
Method one — HTML file. Download tj-verify-TOKEN.html from the dashboard and upload it to your site root.
Method two — meta tag. Paste a single meta tag into the head of your homepage.
<meta name="tj-site-verification" content="YOUR_TOKEN">
Method three — tracking code. If the homepage already runs our tag and has received at least one visit, it is verified automatically. Method four — DNS TXT. Add tj-site-verification=YOUR_TOKEN as a TXT record on the apex domain.
Open API and bulk deploy
Every account ships with a personal API key (prefix tjk_) that lets you list sites, create sites, pull tag snippets and read stats over HTTPS. Authenticate by sending an X-API-Key header.
curl -H "X-API-Key: $TJ_KEY" "https://9ping.dev/openapi.php?action=sites"
To roll the tag out across a whole site group from a single Linux box, download tj-deploy.sh from Manage sites. It registers each domain over the API, generates the tag snippet, and can optionally inject it into your templates.
The Open API supports bulk site creation from a text file, where each line is either a bare domain or domain|name. You can find the full action list in the API reference.
Security: 2-step verification and recovery codes
All dashboard accounts have enforced two-step verification with Google Authenticator (TOTP, RFC 6238). On sign-up you receive ten one-time recovery codes — store them somewhere safe; if you lose your phone these are your only way back in.
Recovery codes are single-use and stored as hashes on the server. To recover, use the Recover with a recovery code link on the sign-in page; the recovery flow will let you set a new password and rebind the authenticator.
Migrate from GA4 or Baidu Tongji
You do not need to remove your existing tag to try 9ping Analytics — both tags can run side by side and report independently, which is the safest way to compare numbers for a week before you switch.
To migrate, add your domain on Manage sites, paste the one-line tag before the closing body tag (or push it through GTM), watch the real-time panel light up, and remove the old tag whenever you are ready.
Custom events translate cleanly: a GA4 event named, for example, signup, with parameters method and plan, becomes tj('event', 'signup', method, plan). Goals and funnels are handled in 9ping by tagging the relevant events; there is no separate goal configuration to maintain.