WebmasterID Docs

WebmasterID HTML Installation

This is the universal method. A single script tag adds WebmasterID to any static site or framework — no build step, no SDK. It is the exact approach used on helperg.com.

1. Add the tracker script

Place this once in a shared layout, template, or include so it appears on every page exactly once:

<script
  id="webmasterid-tracker"
  defer
  src="https://webmasterid.com/tracker.iife.min.js"
  data-wmid="wm_xxxxxxxxxxxxxxxx"
  data-endpoint="https://webmasterid-ingest-api.vercel.app/api/events">
</script>

Replace data-wmid with your WebmasterID site ID. Keep defer so it never blocks rendering.

2. Add it once, globally

Add the tag in a single shared location, not per page or per component. If your site has no shared layout, the cleanest option is to inject it from one global script, guarded so it runs once:

function loadWebmasterID() {
  if (document.getElementById('webmasterid-tracker')) return;
  var s = document.createElement('script');
  s.id = 'webmasterid-tracker';
  s.defer = true;
  s.src = 'https://webmasterid.com/tracker.iife.min.js';
  s.setAttribute('data-wmid', 'wm_xxxxxxxxxxxxxxxx');
  s.setAttribute('data-endpoint', 'https://webmasterid-ingest-api.vercel.app/api/events');
  (document.head || document.documentElement).appendChild(s);
}

This is essentially the pattern helperg.com uses inside its consent manager — see Privacy & GDPR.

3. Gate it behind consent (recommended)

For GDPR / ePrivacy, call loadWebmasterID() only after the visitor grants analytics consent, instead of on first load. On helperg.com it is invoked from the cookie consent manager once the Analytics category is accepted under Google Consent Mode v2.

Troubleshooting

  • No events: verify the script is present in the rendered HTML (or injected after consent), and that the two data- attributes are set.
  • Duplicate events: the tag is being added more than once — consolidate to one shared include and keep the getElementById guard if injecting dynamically.
  • Request blocked: allow the ingest endpoint in your CSP connect-src and check for content blockers.

FAQ

Where should the script tag go?

In the document head or before the closing body tag, with defer. Add it once in a shared layout so it loads on every page exactly once.

How do I avoid duplicate tracking?

Add the tag in one shared location, not per component. If you inject it with JavaScript, guard with an existing-element check on the id webmasterid-tracker.

Does this work without a consent banner?

Technically yes, but for GDPR/ePrivacy you should load it only after analytics consent. See Privacy & GDPR.

Related

Installation overview · Next.js installation · Privacy & GDPR · What is WebmasterID?