当我们将Google Analytics添加到iOS应用时,如何指定应该和不应该作为会话进行跟踪(不是事件) [英] How to specify what should and shouldn't be tracked as a session (not event) when we add Google Analytics to an iOS app

查看:152
本文介绍了当我们将Google Analytics添加到iOS应用时,如何指定应该和不应该作为会话进行跟踪(不是事件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们通过Google Analytics为iOS或Watch应用程序实例化会话(而不是事件,操作或屏幕)跟踪,有没有什么方法可以指定应该和不应该跟踪的会话,例如不要调用开始生命周期跟踪每次启动 - 例如我不希望后台任务或恢复观看应用程序或激活浏览计数作为会话。作为开发人员,是否有权控制它在发送给Google之前对会话跟踪数据进行归档,或者是否将所有会话跟踪数据自动分配给Google?目前我在 AppDelegate didFinishLaunchingWithOptions

中调用这个函数
$ b

 (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];

//打开GTM标记容器(异步)

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

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


$ b


解决方案

1)有没有办法在iOS上关闭或打开GTM代码中的会话跟踪?



使用GTM无法调整会话跟踪本身UI或数据层,除了防止GA标签被触发(如下所述)。



2)如果应用程序在后台启动,是否有避免会话跟踪的方法?

主要的方法是防止在后台打开应用程序时触发标记,这是设置一个阻止触发器,用于查找指示事件该应用程序在后台启动。然后,即使数据层事件被触发告诉标签被触发,阻塞触发器将阻止标签发射,从而阻止会话开始。


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);

 }
}

解决方案

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.

这篇关于当我们将Google Analytics添加到iOS应用时,如何指定应该和不应该作为会话进行跟踪(不是事件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆