How to create Tests and Triggers

Table of Contents

Prerequisites

AssertionHub Account. Start Free Trial

What are Test and Triggers?

A Test validates a combination of metrics and only fires when its associated Trigger condition is met.

A Trigger defines conditions that activate tests (e.g. “event_name contains page_view AND account_id equals G-123X”).

Each metric has three fields: Metric Key (e.g. item_name), Comparison (e.g. includes, exists), and Expected Value (e.g. T-shirt, pc).

How to create a Test?

Create tests in three ways:

  • From a collected event - Click detected events (e.g. “add_to_cart”) during checks and select metrics to test
  • From predefined templates - Import templates with pre-filled metrics when we detect matching events
  • From scratch - Manually configure tests by choosing your vendor and metrics

Create Test and Triggers from request

  • From Recorder

    1. Click on User Journey Recorder in the left sidebar to open the Recorder page
Create Test and Triggers
  1. Load an existing one or create a new User Journey. For now, we will load the one generated during the free trial
  2. Click on “Continue Rec” and wait for the replay to finish
  3. In the meantime the replay finishes, you will see on the right side all the detected events and Data Layer Push
  4. Find an event you want to create a test for and click on the plus icon. This opens the Create Test from Request panel.
Create Test and Triggers
  • From User Journey Test Results Page

    1. Click on a User Journey result in /admin to open the User Journey Result page
Create Test and Triggers
  1. From the User Journey Page, find an event you want to create a test for and click on the plus icon on the event row. This opens the Create Test from Request panel.
Create Test from request
  1. Name your test, add a description (optional), and choose the Logical Operator for Test and Trigger:

    • OR - Any selected metric evaluates to true
    • AND - All selected metrics must evaluate to true
  2. Select at least one metric as Trigger and one as Test (e.g. event name as trigger and a custom dimension as test metric). You can test any parameter, object, or nested value.

  3. Click “Create Test” top-right of the panel

Note: For metrics appearing multiple times (e.g. item_id across all GA4 items), click Global to test all occurrences.

Create Test from request
  1. Fill in the basic details of the test.
  2. Choose at least one metric as Trigger (e.g. event name) and then one or more metrics as Test (e.g. custom dimension value).

Create a test from scratch

  1. Click any element in the left navbar under “Elements”
  2. Click “Create Trigger/Test”
  3. Select your vendor (e.g. GA4, Google Tag Manager)
  4. Name your test/trigger, add a description, and select the Logical Operators
  5. Click “Add Metric” and enter the Metric Path:
    • Nested metrics: pr1.item_name
    • Object itself: products
    • Basic metrics: en (for GA4 event name)
    • Multiple occurrences: item_name checks all instances
    • Specific instance: pr2.item_name checks only that one
  6. Make sure to select at least one Metric as Trigger
  7. Click “Create Test”

How to edit a Test and a Trigger

Go to “All Elements” in the left sidebar to view all your user Journeys and tests. Click the edit icon at the end of any row to open the edit panel.

Powered by beluacode Logo