Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Tag Manager Container Setup for iOS in PROD and STAGING

I am trying to put 2 containers in my XCode project (1 for STAGING and another for PROD). Is this possible in Google Tag Manager? If so, how do I achieve it?

like image 682
Ace Rivera Avatar asked Oct 18 '25 12:10

Ace Rivera


1 Answers

You can use build script to copy necessary file to yourProjectName/container folder before run.

Go to Project -> Targets -> YourTarget -> Build Phases, add New Run Script Phase, add script like this:

rm -vf ${SRCROOT}/container/*
if [ "${CONFIGURATION}" == "Release" ]; then
cp -v "${SRCROOT}/App/Analytics/GoogleTagManager/XXXXXXX_release.json" "${SRCROOT}/container/GTM-XXXXXXX.json"
elif [ "${CONFIGURATION}" == "Debug" ]; then
cp -v "${SRCROOT}/App/Analytics/GoogleTagManager/YYYYYYY_debug.json" "${SRCROOT}/container/GTM-YYYYYYY.json"
fi

Folder yourProjectName/container will be cleared every run, and debug or release container .json file will be copied.

like image 170
mytrycatch Avatar answered Oct 21 '25 03:10

mytrycatch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!