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.
Tag Setup in GTM
1. Create 4 User-Defined Data Layer Variables (DLV)
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 |
2. Create a GA4 Event Tag for view_experiment
- Tag Type: GA4 Event
- Measurement ID: Replace with your actual GA4 ID
- Event Name:
view_experiment
- Event Settings Variable: GA4 Event Settings
3. Configure Event Parameters
Event Parameter | Value |
---|---|
experiment_id | DLV - experiment_id |
experiment_name | DLV - experiment_name |
experiment_variant_id | DLV - experiment_variant_id |
experiment_variation | DLV - experiment_variation |
4. Configure GTM Consent Settings
- Enable additional consent checks.
- Require consent for:
ad_storage
,analytics_storage
, andpersonalization_storage
.
5. Create a GTM Trigger
- Trigger Type: Custom Event
- Event Name:
view_experiment
- Fires On: All Custom Events

BigQuery Integration with GA4 & PackDigital
1. Create or Use an Existing GCP Project
- Create a new project or use an existing one via the Google Cloud Console.
2. Enable BigQuery API
- Enable the BigQuery API for your project.
3. Create a Service Account
- Navigate to Service Accounts → Create Service Account.
- Assign the roles BigQuery Job User and BigQuery Data Viewer.
- Complete the creation process.
4. Generate a Service Account Key
- Open the created Service Account.
- Go to Manage Keys → Add Key → Create new key (choose JSON format).
- Save the downloaded
.json
file securely.
5. Link GA4 to BigQuery
- In GA4, navigate to Admin → BigQuery Links.
- Click Create Link and select your BigQuery project.
- Confirm your selection.
6. Connect BigQuery to PackDigital
- In PackDigital Admin, navigate to Store > Settings > Integrations.
- Click Create New Integration and select BigQuery.
- Provide:
- GCP Project ID (e.g.,
g4a-bigquery-pack-data
) - Dataset Name (e.g.,
analytics_GA4PROPERTYID
) - Service Account JSON File (paste the JSON key from Step 4)
- GCP Project ID (e.g.,
Example JSON Service Account Key:
{
"type": "service_account",
"project_id": "g4a-bigquery-pack-data",
"private_key_id": ".....",
"private_key": "....",
"client_email": "pack-bigquery-access@g4a-bigquery-pack-data.iam.gserviceaccount.com",
"client_id": "XXXXX",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/pack-bigquery-access%40g4a-bigquery-pack-data.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
- Click Save.