How to create Tests and Triggers
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
- Click on User Journey Recorder in the left sidebar to open the Recorder page
- Load an existing one or create a new User Journey. For now, we will load the one generated during the free trial
- Click on “Continue Rec” and wait for the replay to finish
- In the meantime the replay finishes, you will see on the right side all the detected events and Data Layer Push
- Find an event you want to create a test for and click on the plus icon. This opens the Create Test from Request panel.
-
From User Journey Test Results Page
- Click on a User Journey result in /admin to open the User Journey Result page
- 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.
-
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
-
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.
-
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.
- Fill in the basic details of the test.
- 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
- Click any element in the left navbar under “Elements”
- Click “Create Trigger/Test”
- Select your vendor (e.g. GA4, Google Tag Manager)
- Name your test/trigger, add a description, and select the Logical Operators
- 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_namechecks all instances - Specific instance:
pr2.item_namechecks only that one
- Nested metrics:
- Make sure to select at least one Metric as Trigger
- 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.