Skip to content

It's an abstract layer to implement analytics events without any service defined.

License

Notifications You must be signed in to change notification settings

Tavernari/SwiftAnalytics

Repository files navigation

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.

About

It's an abstract layer to implement analytics events without any service defined.

Resources

License

Stars

Watchers

Forks

Packages

No packages published