Analyze RightMessage tests in GA4 and Google Tag Manager
You'll send every RightMessage A/B test version to Google Analytics 4 or your Tag Manager data layer, so you can compare versions with the rest of your analytics.
Updated
View as MarkdownSee which RightMessage test version each visitor saw right inside Google Analytics 4, next to the revenue, funnels and audiences you already track there. RightMessage sends it automatically once an analytics app is on. You don't tag anything per test.
This works for page and audience A/B tests, campaign holdbacks, and question, form, offer and flow split tests. You can turn on the analytics apps on every plan, but impressions come only from what's running on your site: holdbacks (Scale and Pro), page and audience A/B tests (Pro), and split tests (every plan). Holdbacks and the Send to your analytics panel on a campaign's Testing tab need Scale or Pro, and starting an A/B test needs Pro.
Choose how impressions reach Google
| Your site runs… | Turn on | What RightMessage sends |
|---|---|---|
GA4 with gtag.js on the page | Google Analytics | A GA4 experience_impression event |
| GA4, or other tags, through Google Tag Manager | Google Tag Manager | A dataLayer push with event: 'rm_experience_impression' |
You can turn on both. The two event names differ, so one impression is never counted twice.
- Open Project settings (the gear at the bottom of the sidebar), then Integrations, and choose the Analytics tab.
- Turn on the Google Analytics switch, the Google Tag Manager switch, or both.
- Publish your changes. Impressions go only to enabled, published apps.
RightMessage doesn't install Google Analytics or Tag Manager. It uses the gtag function or dataLayer already on your page.
Use the GA4 event
Each time RightMessage counts a visitor in a test version, it calls:
exp_variant_string is RM-<experienceId>-<variantId>, the format GA4's experiment reporting reads. To break reports down by version:
- In GA4, open Admin, then Custom definitions.
- Create an event-scoped custom dimension for the parameter
exp_variant_string. Addrm_variant_nametoo if you'd like readable names. - Wait for new data. GA4 doesn't fill in custom dimensions for events it collected earlier.
Then compare your conversions or revenue by exp_variant_string in an exploration.
rm_variant_name is the name RightMessage shows for the version. In question, form, offer, and flow tests, that's Control, then Variant A through Variant D in order, unless the variant has its own name. Before November 2026, question and offer tests could send older default names, such as Variant 1 or Variant B, so a test that was running then can show two names for the same version. The version ID at the end of exp_variant_string doesn't change, so group by that string rather than by name.
Use the Google Tag Manager event
With the Google Tag Manager app on, each impression is pushed to your data layer:
Every key is present on every push, and null when it doesn't apply. rm_experience_kind is holdback, original_test, audience_test, flow_test, question_test or offer_test.
- In Tag Manager, create Data Layer Variables for
exp_variant_stringand any other keys you need. - Create a Custom Event trigger with the event name
rm_experience_impression. - Add a tag that fires on it, such as a GA4 event tag that sends
exp_variant_stringas a parameter, or a tag for another analytics tool. - Preview, then publish your container.
Find each version's string
On the campaign's Testing tab, open Send to your analytics on a test. It lists each version's GA4 experiment string with a copy button, plus the Google Tag Manager event name and the Page event name. Preview this version on your site opens your site showing that version. Before the test starts, the panel says "Starts sending when the test starts."
Every test that has started also has Send to your analytics in the menu on its report. Open A/B testing under Optimize and select the test. That's where to find a question, form, offer, or flow test's strings.
Check that impressions arrive
Visit your site in a browser that isn't excluded, on a page with a running test, and look for the event in GA4's DebugView or realtime report, or in Tag Manager's preview.
Nothing is sent:
- from a browser you've excluded, including any browser that has opened the debugger;
- in previews and debugger sessions;
- before cookie consent, when the project waits for consent;
- when
gtagstill isn't on the page after RightMessage's last retry, about 15 seconds after the page loads, for the Google Analytics app.
Your analytics counts are your own analysis. RightMessage's verdicts, on the A/B testing page and the campaign's Testing tab, come from its own counts and refresh every hour. See read A/B test results. For other tools, use PostHog or the rm:experience-impression page event.