我知道有很多关于谷歌分析问题的问题和答案,但对我没有任何帮助。
我已经安装了 google with pods
pod 'GoogleAnalytics'
并将其导入桥接 header 中,并在 appDelegate 中使用此代码
<GoogleAnalytics/GAI.h>
"GAIDictionaryBuilder.h"
guard let gai = GAI.sharedInstance() else {
assert(false, "Google Analytics not configured correctly")
}
GAI.sharedInstance().defaultTracker = gai.tracker(withTrackingId: "UA-109196643-1")
// Optional: automatically report uncaught exceptions.
gai.trackUncaughtExceptions = true
GAI.sharedInstance().dispatchInterval = 20
GAI.sharedInstance().dispatch { (result) in
print(result)
}
// Optional: set Logger to VERBOSE for debug information.
// Remove before app release.
gai.logger.logLevel = .verbose;
这是日志文本
INFO: GoogleAnalytics 3.17 -[GAIBatchingDispatcher hitsForDispatch] (GAIBatchingDispatcher.m:369): No pending hits. INFO: GoogleAnalytics 3.17 -[GAIReachabilityChecker reachabilityFlagsChanged:] (GAIReachabilityChecker.m:161): Reachability flags update: 0X000002
这是我登录屏幕时的日志
GoogleAnalytics 3.17 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:518): Saved hit: { parameters = { "&_crc" = 0; "&_s" = 9; "&_u" = ".npetoK9L"; "&_v" = "mi3.1.7"; "&a" = 1028296819; "&aid" = "******"; "&an" = Mataam; "&av" = "1.0"; "&cid" = "59cc9c6e-be21-4ac8-b6d9-d3beff894dbf"; "&dm" = "x86_64"; "&ds" = app; "&sr" = 1242x2208; "&t" = screenview; "&tid" = "UA-109196643-1"; "&ul" = en; "&v" = 1; "&z" = 15726875618543142345; Login = name; gaiVersion = "3.17"; }; timestamp = "2017-11-11 15:42:53 +0000"; }
所以问题是我没有在分析中获取任何数据,我还设置了 firebase,这可能是问题所在,因为我正在那里获取数据。
最佳答案
我发布了一个新答案,因为这是我的答案并且我添加了更多详细信息:
您可以使用 Firebase SDK 并在您的 Google Analytics 帐户中获取分析。 您只需将它们链接在一起。
按照说明操作:
Link to instructions on Google Help
- Sign in to your Google Analytics account.
- Click Admin.
- In the PROPERTY column, select Create new property from the dropdown menu.
- Select Mobile app.
- Connect to Firebase. If you do not have a Firebase account, go to firebase.google.com to get started. Once you have completed the setup, return to Google Analytics and complete the above steps.
关于ios - Google Analytics iOS 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47239849/