0
我試圖使用Google跟蹤代碼管理器向Google Analytics發送屏幕視圖。我已經根據他們的指示設置了一切,但只有前幾次命中才能正確發送給GA。Google Tag Manager iOS screenName
代碼片斷我用來追蹤屏幕視圖(我也tryed發硬編碼的屏幕名值):
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