Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 1.73 KB

README.md

File metadata and controls

62 lines (47 loc) · 1.73 KB

SwiftAnalytics

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

To register a broker

SwiftAnalytics.registerBroker(name: "AnalyticsService") { event in
    //Call your service here like Firebase, GameAnalytics, etc...
}

To call an analytic event

SwiftAnalytics.dispatch(event: AnalyticsEvent(name: eventName1))

To call an screen event

SwiftAnalytics.dispatch(event: ScreenEvent(name: eventName1))

To creat your own event

public class CustomEvent: Event {
    public let name: String
    public let kind: Kind = .custom("MY OWN EVENT KIND")
    public var params: [String: Any]?

    public init(name: String, customParam:Int) {
        self.name = name
        self.params = ["custom": customParam]
    }
}

To remove a broker

SwiftAnalytics.unregisterBroker(name: "YOUR_BROKER_NAME")

Installation

SwiftAnalytics is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SwiftAnalytics'

Author

Tavernari, victortavernari@gmail.com

License

SwiftAnalytics is available under the MIT license. See the LICENSE file for more info.