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 holdbacks and A/B tests (Scale and Pro) and split tests (Pro). Holdbacks and the Send to your analytics panel 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 Integrations, then Other integrations.
- Choose Enable on the Google Analytics card, the Google Tag Manager card, 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.
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."
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
gtagisn't on the page, for the Google Analytics app.
Your analytics counts are your own analysis. RightMessage's verdicts on the Testing tab use its own weekly checks. See read A/B test results. For other tools, use PostHog or the rm:experience-impression page event.