0

I know that app-level opt out flag will disable or re-enable Google Analytics across the entire app. Based on the reference: https://developers.google.com/analytics/devguides/collection/ios/v2/advanced#sampling

// Set the app-level opt out preference.

[[GAI sharedInstance].setOptOut = YES];

Is there any way to set this flag for Google Tag Manager as well? to filter or control the session tracking?

Samira
  • 215
  • 2
  • 14
  • Google Tag Manager doesn't actually perform any tracking, it just provides the tools to do so with other applications such as Google Analytics. All Google Tag Manager really does is provide a box for you to inject HTML, a handful of event listeners and a useful infrastructure. – J Brazier Jul 01 '16 at 08:01
  • Thanks for the response could you explain a little more, I can only set this opt out flag for the container? and do you know, is there any way to filter the tracking data before sending to Google Analytics? http://stackoverflow.com/questions/38107646/how-to-specify-what-should-and-shouldnt-be-tracked-as-a-session-not-event-whe?noredirect=1#comment63666676_38107646 – Samira Jul 02 '16 at 14:11
  • It's possible that Google Tag Manager does provide an opt-out, but I doubt it; Google Tag Manager is just a mechanism, it doesn't record any data, so there's no need for Google to provide an opt-out. You can indeed filter data before sending it to Google Analytics; you can manually adjust any of the data that you would send, as well as adding your own custom dimensions and variables. – J Brazier Jul 03 '16 at 17:02
  • Based on my investigation, the only way to filter the traffic before sending to Google Analytics is to create custom dimensions and manually adjust the tracking data for those created custom dimensions. – Samira Jul 03 '16 at 23:32
  • In the set-up for an individual Google Analytics tag, you can use the 'Fields to set' to manually adjust any of the information that you're sending to the tag. – J Brazier Jul 04 '16 at 10:04
  • Thanks again, and do I need to change anything in the code as well? – Samira Jul 04 '16 at 12:54
  • Nope, so long as your tags are only mounted on Google Tag Manager. There are a few wirds from Simo Ahava about 'Fields to Set' here http://www.simoahava.com/gtm-tips/setting-google-analytics-fields-in-gtm/#gref – J Brazier Jul 04 '16 at 13:11
  • Thanks for the link , I need to convince my manager that there is no way in the source code to filter out the session tracking data before sending to Google. He believes that definitely there is a solution for that! and he thinks "Fields to set" is not a solution and since we're using GTM so even there is no way to stop session tracking in the background mode, if we were using GA at least we had opt-out flag to set to the FALSE value for the background state. – Samira Jul 04 '16 at 16:02
  • There are ways to filter out the tracking data if you aren't using Google Tag Manager, but doing so with Google Tag Manager is significantly easier. Why can't you use Fields to Set? What are you trying to filter, anyway? – J Brazier Jul 05 '16 at 09:38
  • For example we don't want to send session tracking data to Google if the glance screen of Watch app is activated or we're not going to do session tracking if the app is in the background state.But as we're instantiating the Google analytics in the didFinishLaunchingWithOptions in AppDelegate so all background processing data are tracked as well. – Samira Jul 05 '16 at 15:02
  • OK, so in that case, if you're deploying Google Analytics entirely using Google Tag Manager, you can adjust the trigger for the Tag to not fire if the app is in the background state. It's just one option. – J Brazier Jul 05 '16 at 15:27
  • I don't know how to do it in the code. I couldn't find any related property or function for Google Tag Manager to do that. – Samira Jul 05 '16 at 15:35
  • In the Google Tag Manager Console, you have to attach a trigger to every tag. It's this trigger that you want to adjust. – J Brazier Jul 05 '16 at 15:37
  • Just now I checked, there is already a trigger for every tag. Tags --> Event Tracker, Location Tracker, Page View and Trigger --> Event - Event Tracker, Event - Location Tracker, Event- Page View – Samira Jul 05 '16 at 15:47
  • Yes, those triggers are what's making the tags fire in the first place. If you don't want your tags to fire under certain conditions, edit the triggers to recognise that. – J Brazier Jul 05 '16 at 15:51
  • I'll consider it, thanks for your help. – Samira Jul 05 '16 at 15:56

0 Answers0