Pantheon Environment - Google Analytics Tracking

I need some clarification on a matter. We have three environments DEV, TEST, and LIVE. Obviously we want & have Google Analytics tracking on the Live environment. To implement any analytic changes we have to make those changes in DEV, then push those to TEST (while pulling content & database from LIVE). Then we can commit those changes to LIVE. I then run Search & Replace to verify there aren’t any DEV & TEST URLs in the LIVE environment. (A Few URLs always seem to slip through).
After this do I have to remove the GA tracking from DEV & TEST to prevent GA from seeing traffic on these two environments? This would seem like extra & double effort. Is there not parameters in place to naturally prevent platforms such as Google Analytics from seeing any developer/editor traffic on the DEV & TEST environments?


Hello ARSGeek.

I’d highly recommend using Google Tag Manager to handle analytics if you aren’t already. It will allow you to make and test these changes without having to do all that URL manipulation.

You can even use the GTM environments feature to split out your tracking by dev / test / live.

Depending on how you are implementing tag manager you could use Terminus Secrets or our environment variables to decide which environment tracking snippet to include.

1 Like