TagGuidesGoogle Tag Manager

GTM integration

If you already use Google Tag Manager, this is the easiest path. You’ll create one loader tag plus event tags for the actions you want to track. No engineering changes to your site beyond a single GTM container.

1. Install the Thrad loader (once)

In GTM, create a Custom HTML tag called Thrad — Loader and paste this. Set the trigger to All Pages, and firing priority to a high value (e.g. 100) so the loader runs before any event tag below.

<script>
  window.thradTag = window.thradTag || function () {
    (window.thradTag.q = window.thradTag.q || []).push(arguments);
  };
  window.thradTag("set", {
    tag_id: "<YOUR_TAG_ID>",
    channel: "web"
  });
</script>
<script async src="https://cdn.thrad.ai/tag.min.js"></script>

Replace <YOUR_TAG_ID> with the tag ID Thrad sent you (adv_<name>_<id>).

That’s enough to start receiving page views and dwell time — they’re tracked automatically by the SDK.

2. Track custom events

For each event you want to track, create a Custom HTML tag in GTM, attach it to the trigger that matches the action (the dataLayer event your theme already emits, a click trigger, a form submit, etc.), and paste a snippet like the ones below.

{{DLV - …}} references in the snippets are GTM Data Layer Variables — replace them with the variables you’ve set up in your container (or hard-code values if you prefer).

Items added to cart

<script>
  window.thradTag("event", "items_added", {
    content_id: {{DLV - ecommerce.items.0.item_id}},
    quantity:   {{DLV - ecommerce.items.0.quantity}},
    value:      {{DLV - ecommerce.value}},
    currency:   {{DLV - ecommerce.currency}}
  });
</script>

Checkout started

<script>
  window.thradTag("event", "checkout_started", {
    value:    {{DLV - ecommerce.value}},
    currency: {{DLV - ecommerce.currency}}
  });
</script>

Lead created (form submission)

<script>
  window.thradTag("event", "lead_created", {
    form_id: {{DLV - form_id}}
  });
</script>

See the full list of standard events in Track events. Custom event names are accepted — just call thradTag("event", "<any_name>", { … }).

3. Track conversions

Create a Custom HTML tag called Thrad — Conversion. Trigger it on the order confirmation / thank-you page only — either by URL match (Page URL contains /order-confirmation) or on the GTM purchase dataLayer event.

<script>
  window.thradTag("conversion", {
    order_id: {{DLV - ecommerce.transaction_id}},
    value:    {{DLV - ecommerce.value}},
    currency: {{DLV - ecommerce.currency}}
  });
</script>

The Tag automatically attaches the click attribution captured from the original landing URL — you don’t need to pass click_id here.

Where to fire it The server dedupes by order_id, so a retry of the same order won’t double-count. But firing on other pages risks sending the call without an order_id (real duplicates) or with the wrong one (misattribution).