Skip to content

Conversation

daniel-graham-amplitude
Copy link
Collaborator

@daniel-graham-amplitude daniel-graham-amplitude commented Sep 25, 2025

Summary

The goal of this PR is to deprecate https://github.com/amplitude/amplitude-js-gtm/ in favour of having the GTM code snippet being deployed in amplitude-typescript, alongside analytics-browser

In this PR

  • Added an EJS template for amplitude-wrapper that takes the contents of the analytics-browser and plugin-session-replay-browser scripts and puts them into "amplitude-wrapper.js" (similar how we did in amplitude-js-gtm)
  • Added a rollup script that takes the js file that's generated above, and then gzips it
  • Added a test page to the test-server that runs a test on the above gzipped page
  • Set the version of the new script to be the same as "analytics-browser" so that they are always released concurrently

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as draft September 25, 2025 16:56
@daniel-graham-amplitude daniel-graham-amplitude changed the title DRAFT: feat: add gtm-snippet chore: migrate GTM snippet to amplitude-typescript Sep 26, 2025
@Mercy811
Copy link
Contributor

Set the version of the new script to be the same as "analytics-browser" so that they are always released concurrently

Do you mean to set the new package @amplitude/gtm-snippet the same version as @amplitude/analytics-browser? This is a good idea! So that we don't need to map event library version (wrapper version) to the actual SDK version. And there is no requirement to start a npm package from 1.0.0.

@daniel-graham-amplitude daniel-graham-amplitude force-pushed the AMP-140206-add-gtm-sdk-snippet branch from 936bf9f to 68893af Compare October 1, 2025 17:42
@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as ready for review October 1, 2025 18:12
Copy link
Contributor

@Mercy811 Mercy811 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @daniel-graham-amplitude, LGTM!

@daniel-graham-amplitude daniel-graham-amplitude merged commit 401390e into main Oct 6, 2025
10 of 11 checks passed
@daniel-graham-amplitude daniel-graham-amplitude deleted the AMP-140206-add-gtm-sdk-snippet branch October 6, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants