5
votes

I completed the integration of the latest Google Tag Manager (v5) for iOS together with Firebase (https://developers.google.com/tag-manager/ios/v5/). The big change here is that the default container file is not binary anymore, it is plain JSON.

The integration requires that you have a folder (not group!) with the name "container" inside your app workspace. Within this folder the container file should be located. This raises my issue: We have two different GTM Containers, one for the testing/development app and one for production.

  • By using a folder it is not possible for me to add a different container file and set target references.
  • I can not create an additional folder since GTM requires the folder on root level and with the exact name "container"

Does anybody have an idea how this can be solved?

Thanks, Fahim

enter image description here

2

2 Answers

4
votes

You should be able to configure an XCode "run script" build step that clears the container directory and copies the correct container into place.

4
votes

Sample Run Script (if somebody has the same issue):

rm -vf ${SRCROOT}/root_folder/container/*
cp "${SRCROOT}/root_folder/target/test/GTM-XXXXX.json" "${SRCROOT}/root_folder/container/"

It is important that this copy job is done at first within Build Phases, otherwise some other precompiling stuff of GTM does not recognize the container.