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.
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.
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.
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.
data- attributes are set.getElementById guard if injecting dynamically.connect-src and check for content blockers.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.
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.
Technically yes, but for GDPR/ePrivacy you should load it only after analytics consent. See Privacy & GDPR.
Installation overview · Next.js installation · Privacy & GDPR · What is WebmasterID?