Today, I found GoogleAnalytics-iOS-SDK have new 3.0 version in Cocoapods. I upgraded and I try to modified the code of manual screen measurement as below:
今天,我發現google analyticsos - ios - sdk在Cocoapods中有了新的3.0版本。我升級了,我試着修改手動測屏的代碼如下:
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName value:@"Detail View"];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];
However, I always get error about kGAIScreenName is undeclared. Even I add GAIFields.h header, it still not work.
但是,關於kGAIScreenName是未聲明的,我總是會犯錯誤。即使是我添加GAIFields。h頁眉,還是不行。
What did I miss?
我錯過了什么?
86
You have to include two more things:
你必須包括另外兩件事:
#import "GAIDictionaryBuilder.h"
#import "GAIFields.h"
Checking what's in GAIFields.h
I can see that kGAIScreenName
is there:
在GAIFields檢查什么。h我可以看到kGAIScreenName在那里:
extern NSString *const kGAIScreenName; // synonym for kGAIDescription
Might be important point that the current Google Analytics is in beta, so using the latest downloadable SDK is always a good idea. What I tried and what is working currently for me is Version: 3.0 (August 16, 2013)
.
可能重要的一點是,當前的谷歌分析是測試版,所以使用最新的可下載SDK總是一個好主意。我所嘗試的和目前對我有用的是3.0版本(2013年8月16日)。
0
I am using a hardcoded value of @"&cd" for kGAIScreenName and it works perfectly. Found the value in the Measurement Protocol documentation at Google https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking
我對kGAIScreenName使用了@“&cd”的硬編碼值,它工作得很好。在谷歌https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking中找到測量協議文檔中的值
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/08/22/720507c359ace4f2e4b4e7b0a54fd43b.html。