window.dataLayer. Your GA4 property
picks it up like any other custom event.
The event
Per (visitor, experiment, pageview):experience_impression. The single most useful
field is exp_variant_string, which follows GA4’s convention for
experiment slicing.
In GA4
To slice any GA4 conversion by variant:- Admin → Custom definitions → Create custom dimension.
- Dimension name, “ABTestly variant”.
- Scope, User (persists across events for this user).
- User property,
exp_variant_string.
Where the event fires
On exposure. That is once per (visitor, experiment, pageview), not once per goal, not once per session. The event lands at the moment the variant applies, which is what you want for attributing downstream conversions.Consent
The GA4 adapter respects the same consent gate as ABTestly’s own beacons. In deferred consent mode, the adapter waits for grant before pushing anything. If you have GA4 consent mode set up on your side, the two systems compose. ABTestly does not push its event until its own consent gate is satisfied; GA4 does not fire its conversion until its own consent mode allows it.In preview
Adapter pushes are suppressed in preview. Your GA4 property does not see previewed exposures.When the SDK is not on the page
Ifwindow.dataLayer does not exist when the exposure fires, the
adapter no-ops silently and reports a first-occurrence-per-session
/err event. Your dashboard’s Snippet health panel will surface
that.
Fix: load gtag.js (or GTM’s snippet) somewhere in <head>, before
or after ABTestly, either order works, as long as
window.dataLayer is defined by the time an experiment first
exposes.