Mahesh Talada
Mahesh Talada

Reputation: 115

How to setup Google Analytics 4 for Multiple GTM Environments (Dev, Prod)

I need solution to set up Google Analytics4 for my website with multiple GTM environments (Dev, Prod).

Earlier for Universal Analytics we have solved this by setting up Lookup Table & tracking IDs (for multiple environments)

Configured till now:

  1. created properties for (Dev & Prod) n set up the data streams(Prod & Dev domains) in Google Analytics
  2. Created custom environments for Dev & Prod in GTM
  3. set up the Google Analytics 4 configuration tag with measurement ID (prod)
  4. Added GTM environment code snippets for ( Dev & Prod)

we can see both Dev & Prod data in GA reports. Which messing entire reports. So we need to forward prod data to GA Prod property n Dev data Dev property.

Upvotes: 6

Views: 2043

Answers (1)

krz
krz

Reputation: 344

You can create separate properties for the PROD and DEV data.
Create a PROD property and setup a data stream for it.
Create a DEV property and setup a data stream for it.
Create a lookup table which outputs the stream id for PROD/DEV depending on the env.
Add the lookup variable to the config tag under "Measurement ID"
The PROD data will then go into the PROD property and the DEV into the DEV

Upvotes: 1

Related Questions