0

If we instantiate session (not event, action or screen) tracking with Google Analytics for an iOS or Watch app, is there any way to specify what should and shouldn't be tracked as a session for example not to call the start lifecycle tracking on each launch -- e.g. I don't want background tasks or resuming the watch app or activating the glance to count as sessions. As a developer, do I have control over it to filer the session tracking data before sending to Google or all session tracking data are automatically dispatched to Google? currently I call this function in AppDelegate didFinishLaunchingWithOptions

(void) initializeGoogleAnalytics: (NSString * ) containerFilename {

 if ([self googleTagManager] == nil) {

  TAGManager * tagManager = [TAGManager instance];

  [tagManager setLogger: [TWNGTMLogger logger]];

  [tagManager setDispatchInterval: 20.0];

  [tagManager setDispatchInterval: 1.0];

  [self setGoogleTagManager: tagManager];

  //Open GTM tag container (async)

  [TAGContainerOpener openContainerWithId: containerFilename tagManager: [self googleTagManager] openType: kTAGOpenTypePreferFresh timeout: nil notifier: self];

  DMLogInfo(DebugLogTypeTracking, @ "Google Analytics initialized, container: %@, version: %@", containerFilename, kGAIVersion);

 }
}
myselfmiqdad
  • 2,518
  • 2
  • 18
  • 33
Samira
  • 215
  • 2
  • 14
  • I don't think you have the ability to define fields to be tracked. It keeps track of everything and you just have to filter what you want when getting from the API – myselfmiqdad Jun 29 '16 at 19:32
  • Thanks for the response, do you know should I filter the session traffic programmatically or in the Google Analytics website? – Samira Jun 29 '16 at 21:08
  • Since you're using Google Tag Manager, you do actually have the power to adjust the data before it gets to Google Analytics. If you can figure out how to identify the traffic you want to ignore, you can tell Tag Manager to ignore it. Otherwise, you can filter it out on Google Analytics. – J Brazier Jun 30 '16 at 07:55
  • Do you know how to tell the Tag Manager to ignore a part of tracking data? is there any function, property,.. I couldn't find anything. – Samira Jul 02 '16 at 14:18

1 Answers1

0

1) Is there a way to turn off or turn on Session Tracking in GTM code on iOS?

There's not a way to adjust session tracking itself using the GTM UI or the datalayer, other than preventing GA tags from firing (mentioned below).

2) Is there a way to AVOID session tracking if the app is launched in background?

The main way is to prevent the tag from firing when the app is opened in the background would be to set up a "blocking trigger" that looks for an event the indicates the app was launched in the background. Then, even if datalayer events were being fired telling the tag to fire, the blocking trigger would prevent the tag from firing, and therefore prevent a session from starting.

Samira
  • 215
  • 2
  • 14