# Implement Session Replay with Google Tag Manager

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Instrumenting Amplitude Session Replay with Google Tag Manager requires a different procedure than the standard [Browser SDK Plugin](https://amplitude.com/docs/sdks/session-replay/session-replay-plugin).

> **Note:**
>
> This article applies to **client-side** GTM instrumentations only.

## Enable Session Replay

To instrument Session Replay with Google Tag Manager:

1. Add the [Google Tag Manager Web Template for Amplitude Analytics Browser SDK](https://amplitude.com/docs/data/source-catalog/google-tag-manager) if you haven't enabled it.

> **Note:** Update the Amplitude tag template
>
> The latest version of the Amplitude Analytics Browser SDK template includes a Session Replay toggle.

2. In Google Tag Manager, create a new tag using the Amplitude template, or edit an existing tag based on the template.
3. In the tag's _Initialization_ section, select **Enable Session Replay Plugin**.
4. In Amplitude, navigate to _Organization Settings > Session Replay Settings_. Update any [masking](https://amplitude.com/docs/sdks/session-replay/session-replay-plugin#mask-on-screen-data), [sample rate](https://amplitude.com/docs/sdks/session-replay/session-replay-plugin#sampling-rate), or other settings.

## Troubleshooting

Multiple instantiation of the Amplitude SDKs is a common problem with GTM and other code injection frameworks. Make sure the initialization logic runs only once in your app. Multiple instantiation can happen if:

- More than one "Init Tag" or another custom tag runs Amplitude.
- Another code injection framework (for example, SquareSpace or Bubble) also runs Amplitude.

This template uses the Amplitude Browser SDK Plugin. For troubleshooting help, refer to [Troubleshooting | Session Replay Plugin](https://amplitude.com/docs/sdks/session-replay/session-replay-plugin#troubleshooting).
