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

时间:2015-04-05 13:11:26

标签: google-analytics xamarin.ios xamarin google-tag-manager

我使用的是Xamarin.iOS,我使用Google AnalyticsSDK(V3.10)集成了TagManager

我可以在日志中看到请求已发送到Google Analytics,但它未显示在信息中心内。

同样的解雇规则同时适用于Android和iOS,它总是(true == true),并且适用于Android。

这是iOS中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 verbose:成功加载补充资源:: {     资源{       key:" account"       key:" analytics_fields"       key:" analytics_pass_through"       key:" anonymize_ip"       key:" arg0"       key:" arg1"       key:" collect_adid"       key:" content_description"       key:" content_group"       关键:"尺寸"       key:" ecommerce_use_data_layer"       key:" enable_ecommerce"       key:" fields_to_set"       key:" function"       key:" instance_name"       key:" metric"       key:" name"       key:" tag_id"       key:" track_appview"       关键:"价值"       价值{         类型:FUNCTION_ID         function_id:" _eq"         101 {#[TAGPServingValue_ext]         }       }       价值{         类型:FUNCTION_ID         function_id:" _c"         101 {#[TAGPServingValue_ext]         }       }       价值{         类型:STRING       规则 {         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 $ 0" }

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

2015-04-05 15:46:59.172 FormsTemplateiOS [2497:60b] GoogleTagManager verbose:将资源保存到磁盘,时间戳为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 verbose:请求容器刷新。

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 verbose:从网络加载资源

2015-04-05 15:46:59.333 FormsTemplateiOS [2497:60b] GoogleTagManager verbose:成功加载补充资源:: {     指纹:" NQ $ 0" }

2015-04-05 15:47:01.919 FormsTemplateiOS [2497:a22b] GoogleTagManager详细:GoogleAnalytics 3.10 - [GAIBatchingDispatcher persist:](GAIBatchingDispatcher.m:497):已保存点击:{     parameters = {         "&安培; _crc" = 0;         "&安培; _U" =" .4nL&#34 ;;         "&安培; _v" =" mi3.1.0&#34 ;;         "&安培;一个" = 968002675;         "&安培;援助" =" com.xxx.xxxxx&#34 ;;         "&安培;一个" = FormsTemplateiOS;         "&安培; AV" =" 1.0&#34 ;;         "&安培; CD" = MyExperts;         "&安培; CID" =" b894aa59-9bae-4939-b9f1-3464a1e9cc76&#34 ;;         "&安培; DS" = app;         "&安培; SR" = 320x480;         "& T公司" = appview;         "&安培; TID" =" UA-xxxxxxx-xx&#34 ;;         "&安培; UL" = en;         "&安培; V" = 1;         "&安培; Z" = 3890884141253459798;         gaiVersion =" 3.10&#34 ;;     };     timestamp =" 2015-04-05 12:47:01 + 0000&#34 ;; }

2015-04-05 15:47:02.985 FormsTemplateiOS [2497:a22b] GoogleTagManager verbose: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详细: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 info:GoogleAnalytics 3.10 - [GAIBatchingDispatcher deleteHits:](GAIBatchingDispatcher.m:509):hit(s)已成功删除

2015-04-05 15:47:04.648 FormsTemplateiOS [2497:a22b] GoogleTagManager info:GoogleAnalytics 3.10 - [GAIBatchingDispatcher didSendHits:](GAIBatchingDispatcher.m:219):2个点击已发送

2015-04-05 15:47:04.651 FormsTemplateiOS [2497:60b] GoogleTagManager info: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

2 个答案:

答案 0 :(得分:0)

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

所以这是24小时等待,如Google官方链接here

中所述
  

“如果您在 24小时之后安装了跟踪并且未在报告中看到数据,则可能会出现以下一个或多个问题。” ...

GoogleAnalytics shows iOS as well!

答案 1 :(得分:0)

此外,您可以使用实时视图查看即将发生的事件。但是会有几分钟的小延迟,所以请耐心等待。