简体   繁体   English

测试Google Analytics iOS SDK

[英]Testing Google Analytics iOS SDK

Has anyone found a good way to test Google Analytics on iOS? 有没有人找到在iOS上测试Google Analytics的好方法? The SDK is really simple but the docs do not discuss how to test or validate. SDK非常简单,但文档不讨论如何测试或验证。

Does the library behave differently on the simulator or when running a debug build config? 库在模拟器上或运行调试构建配置时的行为是否不同?

I setup a delegate GANTrackerDelegate with this delegate method: 我用这个委托方法设置了一个委托GANTrackerDelegate:

- (void)trackerDispatchDidComplete:(GANTracker *)tracker
                  eventsDispatched:(NSUInteger)eventsDispatched
              eventsFailedDispatch:(NSUInteger)eventsFailedDispatch;

That method gets called just fine and I see positive values in eventsDispatched and eventsFailedDispatch has always been 0. Beyond that is there a way I can test that those events are being received correctly and correlate with what I think I'm submitting? 调用该方法就好了,我在eventsDispatched中看到了正值,并且eventsFailedDispatch一直是0.除此之外,还有一种方法可以测试这些事件是否正确接收并与我认为我提交的内容相关联?

I'm thinking I need to setup a dedicated GA Website profile for test. 我想我需要设置一个专门的GA网站配置文件进行测试。 Run a fixed set of UI automation unit tests and then wait 24 hours for that data to be available and validate "by hand". 运行一组固定的UI自动化单元测试,然后等待24小时以使该数据可用并“手动”验证。 Ick. 伊克。

Now it's a lot easier with realtime analytics, you see the visit in realtime, and it's working on the simulator : 现在,通过实时分析,您可以更轻松地实时访问,并且它正在模拟器上运行:

https://www.google.com/analytics/web/#realtime https://www.google.com/analytics/web/#realtime

Why not just test the lib separately? 为什么不单独测试lib呢? Write a simple class and make as many calls as you want. 写一个简单的类,并根据需要进行多次调用。 This won't involve any UI automation so should be easy to implement. 这不涉及任何UI自动化,因此应该易于实现。

Mobile Analytics: An End-to-End Walkthrough has a section "Finding Data in the Analytics Web Interface" that says, 移动分析:端到端演练有一节“在分析网络界面中查找数据”,其中说

Bear in mind that it can take the analytics front-end up to 24 hours to process newly collected data. 请记住,分析前端最多需要24小时才能处理新收集的数据。

So it looks like setting up a dedicated GA Website profile for test and performing scripted UI tests is probably your best bet. 因此,设置专用的GA网站配置文件以进行测试和执行脚本化UI测试可能是您最好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM