Integrations

Google Tag Manager

Install Logspot through Google Tag Manager with the Logspot 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 Logspot without touching your codebase. There are two ways:

  • Logspot 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 Logspot snippet yourself.

Option 1: Logspot Analytics Template

  1. Add the template to your GTM workspace, either way:
    • From the gallery: Templates → Tag Templates → Search Gallery, search for Logspot Analytics, and add it to your workspace.
    • From GitHub: download template.tpl from logspot/logspot-google-gtm-template, then Templates → Tag Templates → New → ⋮ → Import and select it.
  2. Tags → New → Tag Configuration → Logspot Analytics, and paste your public key (it starts with pk_). Find it in Project settings.
  3. 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.
  4. 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.logspot.io/lg.js"
  data-logspot-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 Logspot 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 Logspot event from a GTM trigger (e.g. a button click or a dataLayer event), add another Custom HTML tag:

<script>
  // `window.Logspot` is available once the Logspot tag has loaded.
  window.Logspot &&
    window.Logspot.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 Logspot tag fires first.

Prefer a no-tag approach? Add the lgspt- class convention to your buttons (e.g. class="lgspt-sign-up") and Logspot captures the click as a Sign Up event automatically.

Verify It's Working

Use GTM Preview mode to confirm the tag fires, then open the Logspot dashboard — events appear within seconds.