Intempt Docs
Developer DocsQuickstart

Google Tag Manager

Deploy the Intempt JavaScript SDK through a Google Tag Manager container instead of editing your site's code directly.

Overview

Google Tag Manager (GTM) is a tag management system that lets you add and update tracking code on your site without a code deployment. Intempt doesn't have a dedicated GTM connector in the Integrations page, since it doesn't need one: you deploy the same installation snippet used for a direct JavaScript install, as a GTM tag. You get the same autocaptured events either way, but tag changes go through GTM's publish flow instead of your normal release process.

This guide walks through getting your Intempt installation snippet, adding it to GTM as a Custom HTML tag, and publishing it.

Before you begin

You need:

  1. An Intempt account with an organization and project. If you don't have one yet, sign up for a free account.
  2. A Google Tag Manager container already set up for the site you want to track, with permission to create and publish tags.

📘 Good to know

Cloud sources like HubSpot, Shopify, and Stripe connect directly from the Integrations page and don't go through GTM. GTM is only for the JavaScript source.

Installing Intempt through Google Tag Manager

Step 1: Create your API key

The API key tells Intempt which organization and project incoming data belongs to.

To create one:

  1. Go to Settings and open the API keys tab.
  2. Click Create Key.
  3. Name the key, choose Public as the type, and select the project it applies to.
  4. Click Create key, then copy the full key. Intempt shows it once and won't display it again in full.

settings api keys create api key panel - google tag manager - Intempt documentation

Step 2: Create a JavaScript source and copy the snippet

  1. Go to Integrations and click Add Integration.
  2. Under Sources, click the JavaScript tile.

add integration sidebar sources javascript - google tag manager - Intempt documentation

  1. In the Configure JavaScript panel, enter a connection name and copy the installation snippet.

configure javascript panel name snippet - google tag manager - Intempt documentation

  1. Click Connect JavaScript to finish creating the source.

📘 Don't miss out

The snippet contains a placeholder, {YOUR_API_KEY}. Replace it with the public key you copied in Step 1 before you paste it into GTM.

<script>
(function () {
  if (window.intempt) return;
  var queue = [], pending = [];
  var methods = ['identify','group','track','record','alias','consent',
                 'productAdd','productOrdered','productView','logOut',
                 'optIn','optOut','isUserOptIn','recommendation'];
  var stub = { _isStub: true, _queue: queue, _pendingPromises: pending };
  methods.forEach(function (m) {
    stub[m] = function () {
      var args = [].slice.call(arguments);
      if (m === 'recommendation') {
        return new Promise(function (resolve, reject) {
          pending.push({ resolve: resolve, reject: reject });
          queue.push({ method: m, args: args });
        });
      }
      queue.push({ method: m, args: args });
    };
  });
  window.intempt = stub;
})();
</script>
<script src="https://cdn.intempt.com/intempt.min.js?organization=your-org&project=your-project&source=web-source&key={YOUR_API_KEY}"></script>

Step 3: Add the snippet as a tag in GTM

  1. In your GTM container, go to Tags and click New.
  2. Click the tag configuration box and choose Custom HTML.
  3. Paste the full snippet from Step 2 into the HTML field.

gtm custom html tag intempt snippet - google tag manager - Intempt documentation

  1. Name the tag (for example, "Intempt tracking") and click Save.

Step 4: Set the trigger and publish

  1. In the tag's Triggering section, add the All Pages trigger so the snippet fires on every page.

gtm trigger all pages - google tag manager - Intempt documentation

  1. Click Submit, then Publish to push the container version live.

Step 5: Confirm data is coming in

Open Live data feed under Events in the main nav and browse to a page on your site. You should see page view and session events appear in real time. If nothing shows up, use GTM's Preview mode to confirm the tag fires and check that {YOUR_API_KEY} was replaced with your real public key.

Where to go next

On this page