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

  1. In GTM, go to TriggersNew.
  2. Click Trigger Configuration.
  3. Select Custom Event.
  4. Set Event Name to ab-test-setup-complete.
  5. Name the trigger “AB Test Setup Complete”.
  6. Click Save.

Step 2: Create Data Layer Variables (Optional)

If you want to include experiment data as parameters in your page_view:

  1. Go to VariablesNew.
  2. Select Data Layer Variable.
  3. 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

  1. Go to Tags and find your GA4 Configuration or Page View tag.
  2. Under Triggering, remove the “All Pages” trigger.
  3. Add the “AB Test Setup Complete” trigger.
  4. (Optional) Add event parameters:
    • experiment_name{{DLV - Test Name}}
    • experiment_variation{{DLV - Test Variation}}
  5. Click Save.

Step 4: Test and Publish

  1. Click Preview in GTM.
  2. Visit your website and look for the ab-test-setup-complete event in the debug panel.
  3. Verify your GA4 tag fires on this event.
  4. 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.

Leave a Comment

You must be logged in to post a comment.