Skip to content
Docs menu · Tag Manager template

Install — Web

Install With the Google Tag Manager Template

Install AnyReplay from the Google Tag Manager template gallery: the fields it asks for, Consent Mode, the permissions it needs, and how to test it in Preview.

The template is the AnyReplay script tag as a Google Tag Manager tag type. Instead of pasting code into a Custom HTML tag you fill in a few fields, and Tag Manager checks what the template is allowed to do: load the recorder from cdn.anyreplay.com, set up window.anyreplay, and read your consent state.

Add the tag

  1. Add the template

    In your container open Templates → Tag Templates → Search Gallery, search for AnyReplay and choose Add to workspace.

  2. Create the tag

    Open Tags → New → Tag Configuration and pick AnyReplay Session Replay. Paste your project key from the project's setup page in AnyReplay.

  3. Trigger it on every page

    Choose the Initialization - All Pages trigger, or All Pages, so every page load starts or resumes the session.

  4. Preview, then publish

    Use Preview to open your site, check that the tag fired, and watch the setup page in AnyReplay switch to Connected. Then submit and publish the container.

What to enter

FieldValue
Project keyYOUR_PROJECT_KEY
Advanced → Ingest URLhttps://in.anyreplay.com
Mask everything typed into form fieldsOn (the default)

Under Advanced you can also set a sample rate between 0 and 1, a monthly session cap, and debug logging. Each field maps to the option of the same name in the browser SDK reference; see sampling and session caps. Passwords, one-time codes and payment card fields are masked whatever you choose — read masking before you turn the form-field option off on a site with a checkout.

Tick Record only after the visitor grants consent and the template starts the recorder with requireConsent: true: nothing is recorded or stored on the device until the consent type you choose — analytics_storage by default — is granted. If it is already granted when the tag fires, recording starts at once; if the visitor grants it later on the page, it starts then; if they deny it after granting it, recording stops and AnyReplay's stored ids are removed. Your consent platform has to set Consent Mode for this to work. See consent.

Permissions the template asks for

  • Injects scripts from https://cdn.anyreplay.com/v1/ — the recorder.
  • Reads, writes and calls window.anyreplay, and reads and writes window.anyreplay.q — the same queue the script tag sets up.
  • Reads consent state for analytics_storage, functionality_storage and personalization_storage.
  • Logs to the console in debug mode only.

A self-hosted install that serves the recorder from its own host should use the Custom HTML tag instead, because the gallery template only loads from cdn.anyreplay.com. The ingest URL field works with any host.

Check that it works

  • In Tag Assistant the AnyReplay tag shows as Fired; a tag that shows Failed usually means the project key is wrong.
  • In the network panel ar.min.js loads from cdn.anyreplay.com, and requests to in.anyreplay.com are answered with 202.
  • If nothing arrives, see no sessions and Content Security Policy.