GTM & GA4 Integration
GA4 is typically integrated via Google Tag Manager (GTM). Since all Pack Hydrogen sites use GTM, integrating GA4 through GTM enhances consent management.
This page covers the minimal, no-BigQuery setup — the lightest path to segmenting GA4 reports by experiment variant. If you have a BigQuery instance and want raw event-level data, refer to the BigQuery integration guide instead.
The minimal setup requires 4 variables, 2 triggers, and 2 tags.
Variables
Create 4 User-Defined Data Layer Variables (DLV) in GTM. These read experiment data from the Pack data layer and are reused across both tags.
| GTM Variable Name | Data Layer Variable Name |
|---|---|
| DLV - experiment_id | experiment_id |
| DLV - experiment_name | experiment_name |
| DLV - experiment_variant_id | experiment_variant_id |
| DLV - experiment_variation | experiment_variation |
Triggers
CE - view_experiment
Fires when Pack pushes the experiment exposure event to the data layer.
- Trigger Type: Custom Event
- Event Name:
view_experiment - Fires On: All Custom Events
Experiment Values Present
A dedicated trigger for the Pack Experiment User Properties tag. Configured identically to CE - view_experiment — separating them keeps tag management clean and makes the firing intent explicit.
- Trigger Type: Custom Event
- Event Name:
view_experiment - Fires On: All Custom Events
Tags
view_experiment
Sends the experiment exposure as a GA4 event so it appears in the Events report.
- Tag Type: Google Analytics: GA4 Event
- Measurement ID:
{{GA4 ID}} - Event Name:
view_experiment - Event Settings Variable:
{{GA4 Event Settings}} - Event Parameters:
| Parameter Name | Value |
|---|---|
experiment_id | {{DLV - experiment_id}} |
experiment_name | {{DLV - experiment_name}} |
experiment_variation | {{DLV - experiment_variation}} |
experiment_variant_id | {{DLV - experiment_variant_id}} |
- Cleanup Tag: Pack Experiment User Properties
- Firing Trigger: CE - view_experiment
The Cleanup Tag setting ensures Pack Experiment User Properties fires immediately after this tag on the same event, in the correct sequence.
Pack Experiment User Properties
Only needed if you are using GA4 Explore for reporting. If you are using BigQuery, the event parameters on
view_experimentare already available for SQL queries — skip this tag and the GA4 custom dimensions step.
Sets the experiment data as GA4 User Properties so you can segment any GA4 report (sessions, conversions, revenue) by variant — not just the view_experiment event.
- Tag Type: Google Tag
- Tag ID:
{{GA4 ID}} - Configuration Parameters:
| Configuration Parameter | Value |
|---|---|
user_properties.experiment_name | {{DLV - experiment_name}} |
user_properties.experiment_variation | {{DLV - experiment_variation}} |
- Firing Trigger: Experiment Values Present
Google Tag vs GA4 Event: User properties are set via a Google Tag (not a GA4 Event tag) using the
user_properties.configuration parameter prefix. This is the correct GTM tag type for setting persistent user-scoped properties.
GA4: Register the Custom Dimensions
Skip this step if you are using BigQuery for reporting. This is only required for GA4 Explore segmentation.
Before GA4 will accept and store the user properties sent from GTM, they must be registered as custom dimensions in the GA4 property.
- In GA4, go to Admin → Property → Custom definitions → Custom dimensions tab
- Click Create custom dimension and add:
| Dimension Name | Scope | User Property/Parameter |
|---|---|---|
experiment_name | User | experiment_name |
experiment_variation | User | experiment_variation |
Note: There is typically a 24-hour delay before newly registered custom dimensions appear in GA4 Explorer and reports. Create these before publishing your GTM container.
Using the Dimensions in GA4 Reports
Once data is flowing:
- Explore → Free-form: Add
experiment_variationas a row dimension and any conversion metric as a value to compare variants side-by-side - Explore → Funnel exploration: Add a user segment filter on
experiment_variationto compare funnel completion by variant - Standard reports → Comparisons: Use the Comparisons feature to filter the entire report view by
experiment_variationvalue (e.g.experiment_variation = variant)
BigQuery Integration
For deeper analysis — custom SQL queries, joining with first-party data, long-term retention — you can link GA4 to BigQuery and connect it to Pack.
If you have a BigQuery instance, refer to the BigQuery integration guide for the full setup walkthrough.