Google Tag Manager
Deploy the Lapis pixel through GTM and fire browser conversions from dataLayer events.
GTM is a delivery vehicle for the pixel, not a different integration. It is useful when marketing owns your tags and cannot edit site code directly.
1. Pixel tag
- Go to Tags → New → Custom HTML.
- Paste:
<script src="https://cdn.trylapis.com/pixel/v1/lapis-pixel.js" data-key="pk_YOUR_PIXEL_KEY"></script>
- Set the trigger to All Pages. Use the Page View trigger, not DOM Ready, because firing earlier catches more landing sessions.
- Publish the container.
2. Browser conversions via dataLayer
If your site already pushes conversion events to the dataLayer, mirror them to Lapis with a second Custom HTML tag. Here is an example for a purchase event:
<script>
if (window.lapis) {
lapis("purchase", {
value: Number({{DLV - transaction_value}}),
currency: {{DLV - currency}} || "USD",
order_id: {{DLV - transaction_id}}
});
}
</script>
- Create dataLayer variables (
DLV - transaction_value, and so on) for your existing event fields. - Trigger on your purchase or lead custom event.
- The
if (window.lapis)guard matters. For non-ad traffic the function does not exist, so the tag silently does nothing.
3. Server-side conversions
GTM only covers the browser. Verified conversions should still come from your backend via the Conversion API. The same click ID rules apply, and events deduplicate by event_id if you send both the browser and server versions.
GTM-specific notes
- Consent mode: if your container gates tags on consent, the Lapis pixel only fires after consent. Sessions from users who never consent are simply not created. That is the expected privacy behavior, but keep it in mind when comparing session counts.
- Server-side GTM (sGTM): you can also forward conversions from an sGTM container to the Conversion API with a custom template that hits
POST /pixel/server-events. Treat the sGTM container as backend code: thesk_live_key lives in the container config, never in the browser container. - Do not double-install. If the pixel is in GTM, remove any hardcoded snippet from the site (or the other way around).