orta / ARAnalytics

Simplify your iOS/Mac analytics
MIT License
1.84k stars 217 forks source link

Allow custom properties for screen tracking events (Mixpanel) #229

Closed rais38 closed 8 years ago

rais38 commented 8 years ago

With current implementation, in screen tracking events at Mixpanel, our events are called "Screen view" always and there is not possibility to set from the DSL.

For this reason, I added ARMixpanelTrackedScreenEventName property in MixpanelProvider:

[ARAnalytics setupWithAnalytics: @{ /* keys */ } configuration: @{
   ARAnalyticsTrackedScreens: @[ @{
      ARAnalyticsClass: UIViewController.class,
      ARAnalyticsDetails: @[ @{
          ARAnalyticsPageNameKeyPath: @"title",
          ARAnalyticsProperties: ^NSDictionary*(UIViewController *controller, NSArray *parameters) {
                                                 return @{
                                                          ARMixpanelTrackedScreenEventName: @"custom_name"
                                                          };
                                             }
      }]
  }],
...
orta commented 8 years ago

Hey @rais38 - I think this is edge-case-y enough that it's worth making a subclass of this provider in your app code and using that in ARAnalytics instead. It adds cognitive load for someone understanding a specific provider vs how it is for the entire project, in theory could be generic to all providers but then t'd feel weird.

So, thanks for the PR! But I don't think this needs to come upstream!