Google 跟踪代码管理器不会向 Google Analytics 触发事件

Google Tag Manager doesn't fire events to Google Analytics

我正在使用 Xamarin.iOS 并且我已经使用 Google Analytics SDK (V3.10)

集成了 TagManager

我可以在日志中看到请求被发送到 Google Analytics,但它没有显示在仪表板中。

Android 和 iOS 存在相同的触发规则,这始终是 (true == true),并且在 Android 中非常有效。

这是 iOS 中 class TagManager 的代码:

public class IosTagManager : NSObject, ITagManager, ITAGContainerOpenerNotifier
{
    private TAGContainer _container;

    public IosTagManager() 
    {
        var tagManager = TAGManager.GetInstance;

        tagManager.Logger.SetLogLevel(TAGLoggerLogLevelType.Verbose);

        var containerId = "GTM-XXXX";

        TAGContainerOpener.OpenContainer(containerId, tagManager, TAGOpenType.PreferNonDefault, 2.0, this);
    }


    public void Push(string key, string data)
    {
        var dict = new NSDictionary("event", key, "screenName", data);

        TAGManager.GetInstance.DataLayer.Push(dict);
    }


    public void ContainerAvailable(TAGContainer container)
    {
        _container = container;
    }
}

这是来自 TagManager 的日志:

2015-04-05 15:46:58.508 FormsTemplateiOS[2497:7b03] GoogleTagManager 冗长:从 GTM-XXXX 加载默认容器

2015-04-05 15:46:58.558 FormsTemplateiOS[2497:7907] GoogleTagManager 调试:资源不在磁盘上

2015-04-05 15:46:58.561 FormsTemplateiOS[2497:60b] GoogleTagManager verbose: scheduleTask: containerId=GTM-XXXX delay=0.000000

2015-04-05 15:46:59.128 FormsTemplateiOS[2497:60b] GoogleTagManager 详细:已成功加载补充资源::{ 资源{ 键:"account" 键:"analytics_fields" 键:"analytics_pass_through" 键:"anonymize_ip" 键:"arg0" 键:"arg1" 键:"collect_adid" 键:"content_description" 键:"content_group" 键:"dimension" 键:"ecommerce_use_data_layer" 键:"enable_ecommerce" 键:"fields_to_set" 键:"function" 键:"instance_name" 键:"metric" 键:"name" 键:"tag_id" 键:"track_appview" 键:"value" 价值 { 类型:FUNCTION_ID function_id: "_eq" 101{#[TAGPServingValue_ext] } } 价值 { 类型:FUNCTION_ID function_id: "_c" 101{#[TAGPServingValue_ext] } } 价值 { 类型:字符串 规则 { positive_predicate: 3 add_macro: 15 add_macro: 14 } 规则 { positive_predicate: 4 add_macro: 13 remove_macro: 14 } template_version_set: "0" 版本:“5” usage_context: "android" resource_format_version: 1 } 指纹:"NQ[=82=]" }

2015-04-05 15:46:59.170 FormsTemplateiOS[2497:60b] GoogleTagManager 详细:将刷新时间设置为当前时间:1428238019170.355957

2015-04-05 15:46:59.172 FormsTemplateiOS[2497:60b] GoogleTagManager 详细:将资源保存到磁盘,时间戳为 1428238019170.355957

2015-04-05 15:46:59.175 FormsTemplateiOS[2497:60b] GoogleTagManager verbose: scheduleTask: containerId=GTM-xxxxx delay=43200000.000000

2015-04-05 15:46:59.187 FormsTemplateiOS[2497:60b] GoogleTagManager 详细:请求容器刷新。

2015-04-05 15:46:59.190 FormsTemplateiOS[2497:60b] GoogleTagManager verbose: scheduleTask: containerId=GTM-xxxxx delay=0.000000

2015-04-05 15:46:59.192 FormsTemplateiOS[2497:60b] GoogleTagManager 详细:从网络加载资源完成

2015-04-05 15:46:59.333 FormsTemplateiOS[2497:60b] GoogleTagManager 详细:已成功加载补充资源::{ 指纹:"NQ[=82=]" }

2015-04-05 15:47:01.919 FormsTemplateiOS[2497:a22b] GoogleTagManager 详细:GoogleAnalytics 3.10 -[GAIBatchingDispatcher 坚持:] ( GAIBatchingDispatcher.m:497): 保存命中: { 参数 = { "&_crc" = 0; "&_u" = ".4nL"; "&_v" = "mi3.1.0"; "&a" = 968002675; "&aid" = "com.xxx.xxxxx"; "&an" = FormsTemplateiOS; "&av" = "1.0"; "&cd" = 我的专家; "&cid" = "b894aa59-9bae-4939-b9f1-3464a1e9cc76"; "&ds" = 应用程序; "&sr" = 320x480; "&t" = 应用视图; "&tid" = "UA-xxxxxxx-xx"; "&ul" = en; "&v" = 1; “&z”= 3890884141253459798; gaiVersion = "3.10"; }; 时间戳 = "2015-04-05 12:47:01 +0000"; }

2015-04-05 15:47:02.985 FormsTemplateiOS[2497:a22b] GoogleTagManager 详细:GoogleAnalytics 3.10 -[GAIRequestBuilder requestPostUrl:payload:compression:] (GAIRequestBuilder.m:167): 为 https://ssl.google-analytics.com/batch

构建 URLRequest

2015-04-05 15:47:02.990 FormsTemplateiOS[2497:a22b] GoogleTagManager verbose: GoogleAnalytics 3.10 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] ( GAIBatchingDispatcher.m:612): 发送命中 POST: https://ssl.google-analytics.com/batch

2015-04-05 15:47:04.639 FormsTemplateiOS[2497:a22b] GoogleTagManager 信息:GoogleAnalytics 3.10 -[GAIBatchingDispatcher deleteHits:] ( GAIBatchingDispatcher.m:509): hit(s) 成功删除

2015-04-05 15:47:04.648 FormsTemplateiOS[2497:a22b] GoogleTagManager 信息:GoogleAnalytics 3.10 -[GAIBatchingDispatcher didSendHits:] ( GAIBatchingDispatcher.m:219): 2 次发送

2015-04-05 15:47:04.651 FormsTemplateiOS[2497:60b] GoogleTagManager 信息:GoogleAnalytics 3.10 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:208):已发送命中:HTTP 状态 200

2015-04-05 15:47:04.737 FormsTemplateiOS[2497:60b] GoogleTagManager 信息:GoogleAnalytics 3.10 -[GAIReachabilityChecker reachabilityFlagsChanged:] ( GAIReachabilityChecker.m:159):可达性标志更新:0X000002

因此,在我使用 SDK 一天后返回工作岗位后,一切正常,所有关于 iOS 系统的数据现在都显示在 Analytics 控制台中,无需更改任何代码。

所以这是Google官方所说的24小时等待linkhere

"If you have installed tracking and don't see data in your reports after 24 hours, you may have one or more of the following issues." ...

此外,您可以使用“实时”视图查看传入的事件。不过会有几分钟的小延迟,请耐心等待。