Skip to help content
RightMessage

Install RightMessage with Google Tag Manager

You'll add RightMessage to your Google Tag Manager container, publish the tag, and check that your website is sending data to your project.

Updated

View as Markdown

Add RightMessage through Google Tag Manager so you can ask visitors questions and personalize your website without editing its code directly. You'll install the project snippet, then publish your questions, offers, or campaigns separately in RightMessage.

Add the snippet to your container

You'll need a Google Tag Manager web container installed on your site, permission to edit and publish it, and access to your RightMessage project. Check your theme, plugins, and container for an existing RightMessage installation. Use only one copy per page.

If you're changing visible page content, direct installation in your site's head can reduce loading delay. With Tag Manager, its container must load and fire the tag first. Neither method guarantees that the original content will never flash.

Installed directly as the first script in the <head>, the snippet removes RightMessage's link parameters, such as _rm, from the address before other tags read it. Through Tag Manager, that happens only when the container fires the RightMessage tag, so any tag that fires earlier, in the same container or on the page, can still read them.

  1. In RightMessage, select your project and open Project settings (the gear at the bottom of the sidebar), then Website & install.
  2. Under Install snippet, keep Live site selected and choose Copy to copy the full snippet.
Install snippet section of Website & install with Live site selected and the Copy button highlighted in orangeOriginal
Install snippet section of Website & install with Live site selected and the Copy button highlighted in orange
  1. In Google Tag Manager, open your site's web container and choose Tags > New.
  2. Name it RightMessage. Open Tag Configuration and choose Custom HTML.
  3. Paste the full snippet into the HTML field, including its script tags.
  4. Open Triggering, select All Pages, and save the tag.

Keep required consent controls in place. If your installation should cover only selected pages, use a trigger limited to those pages instead. The snippet runs only when its trigger and consent requirements allow it. You don't need Support document.write. Google's Custom HTML guide (opens in a new tab) covers the tag editor.

For a separate test environment, read the live and development snippet reference before choosing Staging & development. That code requests an authorized draft debugger session and disables analytics.

Publish the tag

  1. Choose Preview in Tag Manager and check that the RightMessage tag fires once on a page where it should run.
  2. Check another included page and any excluded page.
  3. Choose Submit > Publish and Create Version.
  4. Review Workspace Changes, including any changes unrelated to RightMessage.
  5. Enter a Version Name and Version Description, confirm the intended environment, and choose Publish.

Saving or previewing the tag doesn't release it. If you can't publish, send the change to the container owner. Google's publishing guide (opens in a new tab) explains its approval controls.

Check that it's working

  1. Visit your public website outside Tag Manager preview.
  2. In RightMessage, open Project settings > Website & install. The status at the top says RightMessage is installed once your first pageview arrives. While it says Waiting for your first pageview, it checks again by itself, or you can choose Check now.
Install status at the top of Website & install for the local example projectOriginal
Install status at the top of Website & install for the local example project

RightMessage is installed means it's receiving data. Use the debugger to see what it's showing on the page.

If no data arrives, check the tag's firing, consent state, project snippet, and published container version. Installation troubleshooting also helps when the snippet loads but nothing appears.

Send A/B test impressions to your data layer

Separately from installing the snippet, the Google Tag Manager app pushes an event to your data layer each time RightMessage counts a visitor in an A/B test version, a campaign holdback, or a split test. You can turn it on on every plan, but those impressions come only from holdbacks (Scale and Pro), page and audience A/B tests (Pro), and split tests (every plan).

  1. In RightMessage, open Project settings > Integrations, then the Analytics tab.
  2. Turn on the Google Tag Manager switch ("Send RightMessage test impressions to your data layer.").
  3. Publish your RightMessage changes.
Google Tag Manager switch turned on in the Integrations Analytics tab, sending RightMessage test impressions to your data layerOriginal
Google Tag Manager switch turned on in the Integrations Analytics tab, sending RightMessage test impressions to your data layer

Each impression is a dataLayer push:

JavaScript
{
  event: 'rm_experience_impression',
  exp_variant_string: 'RM-cpn_5didDYbc-control',
  rm_experience_id: 'cpn_5didDYbc',
  rm_experience_kind: 'holdback',
  rm_experience_name: 'Pricing page campaign · Holdback',
  rm_variant_id: 'control',
  rm_variant_name: 'Held back',
  rm_campaign_id: 'cpn_5didDYbc',
  rm_resource_id: null
}

Every key is present on every push, set to null when it doesn't apply. In Tag Manager, use a Custom Event trigger for rm_experience_impression and Data Layer Variables for the keys you need. The event name differs from GA4's experience_impression, so a site that also runs the Google Analytics app never counts an impression twice. See analyze tests in GA4 and Google Tag Manager.

Next, build a resource recommendation in the app. RightMessage's Publish action is separate from publishing your Tag Manager container.

Still need a hand?

Tell us what you’re trying to do and where you’re getting stuck.

support@rightmessage.com