Install the monitoring script with Google Tag Manager

On this page

With Google Tag Manager (GTM) you can install the monitoring script without touching your site's code: paste it into a Custom HTML tag, or use the Tapper - Monitoring Script template with your entity's public key. Both load the same script on every page.

Before you start

  • GTM is installed on your site, and you can publish in its container.
  • Your workspace has Block.
  • The entity has a connected ad account. Until then, Monitoring in Setup > Website asks you to connect an ad platform first.

Step 1: copy the script from Tapper

  1. With more than one protected entity, pick the entity in the switcher at the top of the sidebar.
  2. Under Setup, click Website, then Monitoring.
  3. Scroll to Monitoring script and click the copy button at the top right of the code box.

The Monitoring script section with Copy monitoring script outlined

The public key is already in the script: the value inside window.tapper.init("..."), starting with pk_live_ or pk_test_. Option B asks for it.

Step 2, option A: a Custom HTML tag

  1. In GTM, open your site's container and go to Tags.
  2. Click New.
  3. Click Tag Configuration and choose Custom HTML.
  4. Paste the script into the HTML field.
  5. Under Triggering, choose Initialization - All Pages, so the script runs as every page starts loading.
  6. Name the tag, for example "Tapper - Monitoring Script", and click Save.

Step 2, option B: the Tapper - Monitoring Script template

  1. Add the Tapper - Monitoring Script template from the Community Template Gallery.
  2. Create a tag and choose Tapper - Monitoring Script as its type.
  3. In Public Key (labeled pk in some versions), paste the key from step 1. The field's help text says to find it under "Settings → Public Key" in Tapper. Ignore that: there is no such setting, and the key is the value inside window.tapper.init("...").
  4. Set the trigger to All Pages.
  5. Name the tag and click Save.

Use one option, not both, so the script loads once per page.

Step 3: publish

  1. Click Submit.
  2. Enter a version name and description, such as "Add Tapper monitoring script".
  3. Click Publish.

What happens next

Use GTM's Preview mode to confirm the tag fires on every page, then check that the monitoring script is working.

If something goes wrong

  • The template rejects the key. Copy it again from inside window.tapper.init("..."), without the quotes. It starts with pk_live_ or pk_test_.
  • The template tag fires and bundle.js loads, but nothing reaches protect.tapper.ai. Delete the template tag, add a Custom HTML tag (option A) and publish again.
  • The tag fires in Preview but Tapper shows no visits. Check your Content Security Policy first, then the check article above.
  • No script appears under Website monitoring. Connect an ad account to the entity first.

Open the install guide on the same tab opens the Monitoring Script guide on docs.tapper.ai. Or write to support@tapper.ai.

Still need help?

Chat with our team and mention this article.