Amplitude Web Implementation

Browser SDK with GTM wrapper & instance Name

Ani Lopez

It is unlikely that you have a hard-coded Amplitude implementation in your websites alongside a second one done with Google Tag Manager and in need of a more advanced solution providing flexibility, scalability and control BUT if that's an scenario you are facing, here you have a way to solve it all in once. Check the code of this page to see it in action. Feel free to copy and tweak as needed.

Analytics Debugger's Kamo in Toronto

The code, as indicated in the HTML comments, can be added into GTM HTML container with the trigger that works in your scenario and the GTM variables to replace the hard coded ones there.

This is how the dataLayer push would look like:

window.dataLayer.push({
  event: 'amplitudeSDK',
  amplitudeSKDstatus: 'initiated',
  amplitudeData: {
    sessionID: 1747403510592,
    deviceID: fdf7f068-f6f6-44d2-b876-cac7f90eb108,
    userID: jI1APYfbocHVc2s
  }
});