# RudderStack GTM Template Refreshed for JavaScript SDK v3


Version `1.1.0` of the RudderStack tag template in the [Google Tag Manager Community Template Gallery](https://tagmanager.google.com/gallery/#/owners/rudderlabs/templates/rudderstack-gtm-template) reworks the integration for [JavaScript SDK v3]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/" >}}). The previous template only supported `page`, `track`, and `identify` against SDK v1.1.

This version of the template brings it in line with the current SDK and closes a class of "tag fired but nothing was sent" failures that were hard to diagnose from GTM alone.

## What's new

- **Full JavaScript SDK v3 API surface**: The template's **Call** dropdown now includes every documented v3 API — `page`, `track`, `identify`, `group`, `alias`, `consent`, `reset`, `startSession`, `endSession`, `setAnonymousId`, `setAuthToken`, `setCustomContext`, and `clearCustomContext` — each with fields that map directly onto the SDK's arguments.
- **Meaningful failure reporting**: When the SDK isn't on the page at call time, the tag now reports a **failure** with a reason in the GTM debug console instead of reporting success and silently dropping the event. Previously, GTM showed the tag as **Fired**, the console was clean, no request left the browser, and everything looked healthy on inspection.
- **Native SDK-loading tag (Method 1)**: A new **`load`** call lets you install the SDK directly from the template — no Custom HTML tag, no hand-pasted snippet. Set **Call** to `load`, fill in your write key and data plane URL, and attach it to the `Initialization - All Pages` trigger. This is also the only path that works for organizations that disable Custom HTML tags in GTM for security review.
- **Custom HTML setup (Method 2) still supported**: Continue to use a Custom HTML tag when you need to pin a specific SDK version, self-host the SDK, or express load options in JavaScript rather than in a GTM variable.

{{< info >}}
The native SDK-loading tag depends on a CDN-hosted loader artifact (`loader-gtm.min.js`) that is being built and released from the [rudder-sdk-js](https://github.com/rudderlabs/rudder-sdk-js) monorepo. Until that artifact ships, continue to install the SDK via a Custom HTML tag (Method 2). The template's `load` call is already in place, so you don't need a template update once the loader is published.
{{< /info >}}

## Supported calls and minimum SDK versions

| Call | Minimum JavaScript SDK version |
| :--- | :--- |
| `page`, `track`, `identify`, `group`, `alias`, `consent`, `startSession`, `endSession`, `setAnonymousId`, `setAuthToken` | `3.0.0` |
| `reset` (always sends `ResetOptions`; never the deprecated boolean) | `3.24.0` |
| `setCustomContext`, `clearCustomContext` | `3.32.0` |

The three original calls (`page`, `track`, `identify`) still work against SDK v1.1, but every other call requires v3.

## Trigger ordering: use `Initialization - All Pages` for SDK setup

The SDK-loading tag — whether the new `load` call or a Custom HTML tag — must fire on the **`Initialization - All Pages`** trigger, not `All Pages`. GTM guarantees that every Initialization tag completes before any Page View tag starts, but within a single event tag order isn't guaranteed. If the SDK tag and your event tags share the `All Pages` trigger, a `page` tag can win the race, find no `window.rudderanalytics`, and dispatch nothing. Previous versions of the template reported success in that case; version `1.1.0` reports a tag failure with a reason.

## Verify your setup

Pair GTM Preview with the [RudderStack Assistant]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/events-tracking-assistant/" >}}) browser extension. GTM Preview confirms whether the tag fired; RudderStack Assistant confirms whether the event actually left the browser and what the payload looked like. Together they eliminate the "fired but nothing sent" failure mode. The extension requires JavaScript SDK v3 or later.

## Resources

- [RudderStack GTM Template in the Community Template Gallery](https://tagmanager.google.com/gallery/#/owners/rudderlabs/templates/rudderstack-gtm-template)
- [Template Source and Full Setup Guide (GitHub)](https://github.com/rudderlabs/rudderstack-gtm-template)
- [JavaScript SDK APIs]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/supported-api.md" >}})
- [JavaScript SDK Quickstart]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/quickstart.md" >}})

