Google跟踪代码管理器iOS屏幕名称

时间:2015-10-13 12:20:09

标签: ios google-analytics tags google-tag-manager

我正在尝试使用Google跟踪代码管理器向Google Analytics发送屏幕视图。我根据他们的指示设置了所有内容,但只有前几次命中才能正确发送给GA。

我用来跟踪屏幕视图的代码片段(我也试图发送硬编码的screenName值):

NSDictionary *update = @{ @"event": @"openScreen",
                          @"screenName": NSStringFromClass([self class]) };

TAGDataLayer *dataLayer = [TAGManager instance].dataLayer;
[dataLayer push:update];

这是参数字典在第一次批量调度到GTM之前的样子。请注意,screenName有“& cd”参数。每次点击直到第一批调度都包含此参数,并且这些屏幕视图已正确保存到GA(我可以在实时概览中看到它们):

GoogleTagManager verbose: GoogleAnalytics 3.13 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
parameters =     {
    "&_crc" = 0;
    "&_s" = 261;
    "&_u" = ".4nL";
    "&_v" = "mi3.1.3";
    "&a" = 1988848940;
    "&aid" = "my.app.id";
    "&an" = "app.name";
    "&av" = "2.1";
    "&cd" = SideMenuTableViewController;
    "&cid" = "bb292639-35a5-4782-8e45-0ba0599cf540";
    "&dm" = "iPhone7,2";
    "&ds" = app;
    "&sr" = 750x1334;
    "&t" = appview;
    "&tid" = "UA-12345678-1";
    "&ul" = "en-sk";
    "&v" = 1;
    "&z" = 3579951951005926748;
    gaiVersion = "3.13";
};
timestamp = "2015-10-13 11:27:24 +0000"; }

但是,在第一次批量调度后,“& cd”参数每次丢失,因此屏幕跟踪停止工作。例如:

GoogleTagManager verbose: GoogleAnalytics 3.13 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
parameters =     {
    "&_crc" = 0;
    "&_s" = 285;
    "&_u" = ".7nL";
    "&_v" = "mi3.1.3";
    "&a" = 1988848955;
    "&aid" = "my.app.id";
    "&an" = "app.name";
    "&av" = "2.1";
    "&cid" = "bb292639-35a5-4782-8e45-0ba0599cf540";
    "&dm" = "iPhone7,2";
    "&ds" = app;
    "&sr" = 750x1334;
    "&t" = appview;
    "&tid" = "UA-12345678-1";
    "&ul" = "en-sk";
    "&v" = 1;
    "&z" = 3579951951005926772;
    gaiVersion = "3.13";
};
timestamp = "2015-10-13 12:00:33 +0000"; }

有时候我也会收到HTTP状态码-1

GoogleTagManager info: GoogleAnalytics 3.13 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:226): Hit(s) dispatched: HTTP status -1

1 个答案:

答案 0 :(得分:0)

2天后它开始正常工作。我没有做任何改动,所以问题可能出在Google的某个地方。