Google Tag Manager (legacy)
This is the client-side Google Tag Manager Template for Amplitude Analytics. The tag uses the Maintenance Amplitude JavaScript SDK for data collection.
This is a legacy template
This is a legacy GTM template. Use the latest template for the most up-to-date implementation.
Migration
The Amplitude Analytics Legacy template, currently using the Maintenance Amplitude JavaScript SDK for data collection, is only slated for bug fixes until its eventual deprecation. Use the latest GTM template that uses Amplitude's Marketing Analytics SDK for data collection. This not only ensures better support but also offers access to a host of new features.
- The latest template isn't backwards compatible with this legacy template because of the non-backwards compatibility of the internal SDK. It does a cookie migration logic to help the transition of legacy cookies information to the latest cookie storage system.
- For a comprehensive migration guide, refer to the Migration guide.
- To understand the behavioral differences between the old and new templates, refer to the comparison section.
Here are the breaking changes:
| Change Area | Amplitude Analytics Browser SDK (GTM Client Template Latest) | Amplitude Analytics Legacy (GTM Client Template Maintenance) |
|---|---|---|
| Core SDK | Marketing Analytics Browser SDK. | Maintenance Amplitude JavaScript SDK. |
| Amplitude initialization | The init function is a separate tag type that requires a dedicated tag. This accommodates deferred initialization, which lets the init tag be called even after an event track call. However, it's critical to note that events don't dispatch to Amplitude until the init tag is explicitly activated. | The init is called by default. Because there's no separate init tag, the initialization process runs as soon as the template loads. |
| Web Attribution | Collects more click IDs and is much easier to configure. Enable attribution tracking in the init type tag for default behavior. Further details are available. | Set the initialization Options for each tag type unless you are using default configuration. Refer to this comparison for the differences in web attribution behavior between the core SDKs. For configuration mapping between the core SDKs, refer to the Migration guide. |
| Page View Tracking | Includes built-in Page View Tracking which you can configure in the init type tag. You can set up the page view tracking trigger and decide whether to track history events automatically. | No built-in Page View Tracking. You can implement your page view tracking using the track type tag. For Single Page Applications (SPAs), the All Pages trigger isn't sufficient for tracking history changes. Add All Pages and History Changes triggers as trigger for the page view tracking accuracy. If you want to add some automatic variables provided by the History Change trigger, navigate to the variable section, configure, and activate all checkboxes under History. After you enable them, you'll see these history variables in the Variables tab in the GTM preview pane. |
EU data residency
For EU data residency, you must set up your project inside Amplitude EU and use the API key from Amplitude EU. You can configure the server zone by checking the checkbox EU Data Residency under Tag Configuration > Initialization.
Was this helpful?