devxoul / Umbrella

☂️ Analytics abstraction layer for Swift
MIT License
615 stars 48 forks source link

Timing events #3

Open Oyvindkg opened 7 years ago

Oyvindkg commented 7 years ago

It may be interesting to know how long it takes before an event to occurs. Timing is supported by most providers, and the implementation is usually very similar to regular events.

devxoul commented 7 years ago

May I have an example? Thanks!

Oyvindkg commented 7 years ago

For example measuring the time it takes to complete a checkout process.

You may do something like this in Mixpanel:

/* When the checkout process is initiated */
Mixpanel.mainInstance().time(event: Event.purchaseCompleted.name)

/* When the purchase is completed */
Mixpanel.mainInstance().track(event: Event.purchaseCompleted.name)

Flurry:

/* When the checkout process is initiated */
Flurry.logEvent(Event.purchaseCompleted.name, withParameters: someParameters, timed: true);

/* When the purchase is completed */
Flurry.endTimedEvent(Event.purchaseCompleted.name, withParameters: nil)
devxoul commented 7 years ago

Looks interesting. But I wonder how could we abstract those methods. Do you have any idea? :thinking: