Web — any site

One script tag before </head>. Works with plain HTML, static-site generators, and every CMS with an editable template.

1. Get your snippet

Every pixel has a unique ID — find your ready-to-paste snippet at the top of the pixel detail page in your dashboard. It looks like this:

index.html
<script async src="https://api.adsping.io/pb.js" data-pixel-id="YOUR_PIXEL_ID"></script>

Keep the async attribute — without it the browser stops parsing your page until our script has downloaded. The script is ~120KB and, loaded this way, never blocks render.

2. Paste it

Put the snippet just before the closing </head> tag, on every page you want to track. Most sites have a single layout file or template that covers the whole site — paste it once there.

3. Verify

  • Open your site, then DevTools → Network → filter adsping.
  • You should see pb.js load (200) and a request to /api/v1/t/PIXEL_ID with the PageView payload (200).
  • In your AdsPing dashboard the pixel detail page shows Last event: a few seconds ago.

What tracks automatically

  • PageView on every page load — no code needed.
  • Click idsfbclid, gclid, ttclid are captured from the URL and attached to every later event.
  • Form auto-capture — submits are detected and email/phone are hashed (SHA-256) client-side for advanced matching.
  • Browser pixels — Meta / TikTok browser scripts are auto-injected (when those destinations are connected) with a shared event id for deduplication.

Script attributes

data-pixel-id is the only required attribute. The rest are opt-in switches you add to the same <script> tag.

AttributeDefaultWhat it does
data-pixel-idRequired. Your pixel ID, from the dashboard.
data-apiapi.adsping.ioSend events to a different ingest host — set this when you use a custom tracking domain.
data-ignore-datalayerfalseSet to "true" and AdsPing never reads or wraps window.dataLayer. Use it when your Google Tag Manager container already fires the ad-platform tags — but read the section below first, because on many sites the bridge is the only source of some events.
data-trust-datalayerfalseSet to "true" if your own container is the only thing writing to window.dataLayer. The email and phone in a push then count as an identity you stated, and we keep them for the visitor instead of using them for that one event only.

When to turn the dataLayer bridge off

By default AdsPing listens to window.dataLayer and turns the standard GA4 e-commerce pushes (purchase, add_to_cart, begin_checkout, …) into events for you. On most sites that is free instrumentation.

It works against you when the same sale reaches us by two roads at once. That happens whenever something else on the page also reports the conversion: a GTM tag that calls adsping('track', …) off the same purchase push, or a Meta / TikTok tag whose call we mirror. Both copies are real, they carry different event ids, and nothing can deduplicate them — conversion count and revenue double.

Turning the bridge off is one way out. Giving both roads the same event_id is the other, and usually the better one — see Purchase.

index.html
<script async src="https://api.adsping.io/pb.js"
        data-pixel-id="YOUR_PIXEL_ID"
        data-ignore-datalayer="true"></script>

With the switch on, your dataLayer keeps working exactly as before for GA4 and every other consumer — AdsPing simply stops reading it. Events you want tracked must then come from your own adsping('track', …) calls or from the browser pixels we mirror.

Check what you would lose before switching it off. On many sites the bridge is the only source of some event types — a container that pushes add_payment_info but has no tag calling us for it loses that event entirely. Open Diagnostics first and confirm every event type you care about still has a second source. The same goes for identity: if your email and phone live in dataLayer.user_data, pass them yourself with adsping('identify', …) — otherwise match quality drops.

Identity from the dataLayer

window.dataLayer is a shared array — your container, a chat widget, an A/B testing script and any agency tag all write to the same place, and a push carries no proof of who wrote it. So an email we read there is treated as a guess: it rides the event it arrived with, it fills a field nothing else supplied, but it never overwrites an identity you sent us with adsping('identify', …) and it is not kept for the visitor's later visits.

That default protects sites whose container is shared. If yours is not — your own GTM is the only writer — say so and your pushes count as statements, exactly like an identify call:

index.html
<script async src="https://api.adsping.io/pb.js"
        data-pixel-id="YOUR_PIXEL_ID"
        data-trust-datalayer="true"></script>

This is the flag to reach for when the dataLayer is your only source of identity — you installed the tag, you never wrote an identify call, and match quality is not improving between visits. Leave it off if another company's tags share the container.

Next steps

  1. Connect a destination — until you do, events are captured and counted but not sent anywhere.
  2. Add conversion events — Lead, Purchase and more, each a one-call setup.
Building with React or Next.js? Use the React / Next.js guide instead — same snippet, plus the SPA route-change note.

Was this page helpful?