CMS & Web Platforms · One line of code

Google Tag Manager integration

Load the SourceTrack tracker from a Google Tag Manager Custom HTML tag, with trigger order, consent notes and the common reasons a tag does not fire.

No credit card required · one script tag

Load the SourceTrack tracker from the Google Tag Manager (GTM) container your site already uses, with no theme edit.

SourceTrack is not a tag in the GTM community gallery. You add a Custom HTML tag in your own container.

What SourceTrack records

Once the tag fires, the tracker records:

  • Pageviews with the referrer and landing page, including client-side page changes.
  • Campaign data: UTM parameters and ad click ids in the landing URL (gclid, gbraid, wbraid, fbclid, ttclid, msclkid, li_fat_id).
  • Time on page and scroll depth, outbound link clicks and tel: link clicks.
  • Form submits from forms on the page, with the form’s id, name and action path, not what the visitor typed.

What SourceTrack does not do

  • It does not detect purchases. Orders come from the SourceTrack WordPress plugin (WooCommerce), a Shopify or Stripe connection, or a sourcetrack.conversion() call.
  • It does not read your dataLayer by default. A dataLayer listener exists, but it needs a data-datalayer-events setting on the script tag and a SourceTrack server setting that is off by default, so do not rely on it.
  • It sends nothing for visitors who send Do Not Track or Global Privacy Control.

Step-by-step setup

Step 1: Create the tag

In your container workspace go to Tags → New, name it, for example, SourceTrack - Base Pixel, and choose Custom HTML.

Step 2: Paste the snippet

Copy the Custom HTML snippet from the GTM setup guide. It first sets up a small call queue, so other tags that call sourcetrack early are held until the script loads. It then adds the tracker script with your site key. Replace YOUR_SITE_KEY with your key.

Step 3: Set the trigger

Use Initialization - All Pages, or All Pages (Page View) if Initialization is not available. Any tag that calls sourcetrack, such as a purchase or consent tag, must not fire before this one.

Step 4: Preview and publish

Use Preview to confirm the tag fires, then Submit and publish. Preview only affects your own browser.

Check that it works

  1. In Tag Assistant, confirm the tag fired.
  2. On the live site, open developer tools, go to Network and filter by track.
  3. Reload and confirm a request to /api/track completes.
  4. Look for the visit in the Event Debugger in your SourceTrack dashboard.

Common problems and fixes

  • The tag never fires. Publish the container, and check the tag’s Advanced Settings for a consent requirement your site does not grant.
  • The container is loaded with a G- or AW- id. Google says such a container only allows Google-provided tags and variables, and a Custom HTML tag is not one. Use a container loaded with its GTM- id.
  • A content security policy blocks the script. Allow https://api.srctk.com in script-src and connect-src.
  • A cookie banner is in use. Add the consent settings described in the GTM setup guide. If you use the consent-required setting, call sourcetrack.consent(true) from a tag when your consent tool grants analytics.
  • You send leads with sourcetrack.conversion() as well. A lead-type browser conversion turns off automatic form conversions for that site, to avoid counting one submit twice.

See also Troubleshooting.


Frequently Asked Questions

Should I choose “Initialization - All Pages” or “All Pages”?

Initialization - All Pages fires before the page’s other tags, so the tracker is loaded before tags that call it. If it is not available, All Pages (Page View) works, as long as your other SourceTrack tags fire after it.

Can I send custom events from GTM?

Yes. A Custom HTML tag can call window.sourcetrack.track('event_name', { ... }). The queue in the snippet holds calls made before the script loads.

Does GTM change how privacy settings work?

No. Do Not Track, Global Privacy Control and the consent settings work the same whether the script is loaded from GTM or from the page head.