Architecture and design patterns for analytics

Hi,

I have google analytics in my app, using a analytics manager class with helper methods.
And a Analytics ViewController that you can subclass for using analytics.

Im trying to clean up my project.
Is there any recommended design pattern/architecture for sealing with analytics?

Thanks,
Ilan

I tend to create a class that sends analytics events. Usually it’s just class methods, such as tagScreen: or tagEvent, so you don’t need to instantiate an instance of that class, you can just fire events off in a single line of code.

I like that solution for two reasons. Firstly, it enables easy debugging, because you can print out what you’re sending as it only goes through a few methods. Secondly, if you change to another analytics package (clients always want to use additional analytics packages down the line), you can integrate it into that single class and you’re good to go.

I’m not really in to the view controller base class method, just because it’s not very scalable, although I seem to remember that Google Analytics recommends that you do that. You can only have one base class, so solving a problem by subclassing can only be done once, you can’t use that solution again.