Testing Google Analytics iOS SDK

混江龙づ霸主 提交于 2019-12-10 01:11:55

问题


Has anyone found a good way to test Google Analytics on iOS? The SDK is really simple but the docs do not discuss how to test or validate.

Does the library behave differently on the simulator or when running a debug build config?

I setup a delegate GANTrackerDelegate with this delegate method:

- (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?

I'm thinking I need to setup a dedicated GA Website profile for test. Run a fixed set of UI automation unit tests and then wait 24 hours for that data to be available and validate "by hand". Ick.


回答1:


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




回答2:


Why not just test the lib separately? 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.




回答3:


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.

So it looks like setting up a dedicated GA Website profile for test and performing scripted UI tests is probably your best bet.



来源:https://stackoverflow.com/questions/4980067/testing-google-analytics-ios-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!