Google Tag Manager
Install Leapio through Google Tag Manager with the Leapio Analytics template or a Custom HTML tag — no code changes to your site.
If your site already runs Google Tag Manager (GTM), you can add Leapio without touching your codebase. There are two ways:
- Leapio Analytics template (recommended): a ready-made tag from the Community Template Gallery with a field for your public key. It also works in containers that don't allow Custom HTML.
- Custom HTML tag: paste the Leapio snippet yourself.
Option 1: Leapio Analytics Template
- Add the template to your GTM workspace, either way:
- From the gallery: Templates → Tag Templates → Search Gallery, search for Leapio Analytics, and add it to your workspace.
- From GitHub: download
template.tplfrom logspot/logspot-google-gtm-template, then Templates → Tag Templates → New → ⋮ → Import and select it.
- Tags → New → Tag Configuration → Leapio Analytics, and paste your public key (it starts with
pk_). Find it in Project settings. - Optional: open Advanced (optional) to set a cookie domain, a pageviews channel, consent source(s), consent behavior, or to strip query parameters from tracked URLs.
- Under Triggering, choose Consent Initialization - All Pages if you use a consent banner, otherwise All Pages. Save.
After you Submit / Publish the container, pageviews start flowing immediately.
Option 2: Custom HTML Tag
In your GTM workspace: Tags → New → Tag Configuration → Custom HTML, and paste:
<script
src="https://cdn.leapio.com/lg.js"
data-leapio-pk="YOUR_PUBLIC_KEY"
></script>Find your public key in Project settings.
Under Triggering, choose All Pages (the built-in Initialization - All Pages trigger is ideal so Leapio loads before other tags). Save.
The script auto-captures pageviews, so after you Submit / Publish the container, pageviews start flowing immediately.
Track Custom Events (Optional)
To send a Leapio event from a GTM trigger (e.g. a button click or a dataLayer event), add another Custom HTML tag:
<script>
// `window.leapio` is available once the leapio tag has loaded.
window.leapio &&
window.leapio.track({
event: 'NewsletterSignup',
metadata: { source: 'footer' },
});
</script>Attach it to whatever GTM trigger represents the action (click, form submission, custom dataLayer event). Use Tag Sequencing so the Leapio tag fires first.
Prefer a no-tag approach? Add the
leapio-class convention to your buttons (e.g.class="leapio-sign-up") and Leapio captures the click as aSign Upevent automatically.
Verify It's Working
Use GTM Preview mode to confirm the tag fires, then open the Leapio dashboard — events appear within seconds.