Delay the GTM page_view until split test data is available.
Delaying GA4 Page View for Test Data
By default, GA4’s page_view event fires on “Container Loaded” – before AB Split Test has assigned variations. This means experiment data won’t be included in your initial page view hit.
To include experiment data in your page_view, you can delay it until the ab-test-setup-complete event fires.
Step 1: Create the Custom Event Trigger
- In GTM, go to Triggers → New.
- Click Trigger Configuration.
- Select Custom Event.
- Set Event Name to
ab-test-setup-complete. - Name the trigger “AB Test Setup Complete”.
- Click Save.
Step 2: Create Data Layer Variables (Optional)
If you want to include experiment data as parameters in your page_view:
- Go to Variables → New.
- Select Data Layer Variable.
- Create variables for:
test_name→ Name it “DLV – Test Name”test_variation→ Name it “DLV – Test Variation”
Step 3: Update Your GA4 Page View Tag
- Go to Tags and find your GA4 Configuration or Page View tag.
- Under Triggering, remove the “All Pages” trigger.
- Add the “AB Test Setup Complete” trigger.
- (Optional) Add event parameters:
experiment_name→{{DLV - Test Name}}experiment_variation→{{DLV - Test Variation}}
- Click Save.
Step 4: Test and Publish
- Click Preview in GTM.
- Visit your website and look for the
ab-test-setup-completeevent in the debug panel. - Verify your GA4 tag fires on this event.
- Click Submit to publish.
Note: The ab-test-setup-complete event fires on every page, even if no experiments apply. This ensures your page_view always fires.