To run the example project, clone the repo, and run pod install
from the Example directory first.
import Swiftlytics
let swiftlytics: AnalyticsProvider = MultiAnalyticsProvider(providers: [
FirebaseAnalyticsProvider(), //requires GoogleServices.info
FacebookAnalyticsProvider(),
AppsFlyerAnalyticsProvider(devKey: "YOUR_DEV_KEY", appId: "YOUR_APP_ID")
])
See Example/Swiftlytics/AppDelegate.swift
struct MemoryWarningEvent: AnalyticsEventConvertible {
let name = "memory_warning"
let count: UInt
}
...
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
count += 1
swiftlytics.trackEvent(MemoryWarningEvent(count: count))
}
swiftlytics.setUserId(UUID().uuidString) // your persistent database value in production
swiftlytics.setUserProperty(name: "name", withValue: "Sandy")
Tested on Xcode 9.4.1, Swift 4, Cocoapods 1.5.3
Swiftlytics is available through CocoaPods, and is split into subspecs to avoid bloat from providers that you do not wish to integrate. To install it, simply add the following line to your Podfile:
pod 'Swiftlytics'
pod 'Swiftlytics/Firebase'
pod 'Swiftlytics/AppsFlyer'
pod 'Swiftlytics/Facebook'
s.subspec 'AppsFlyer' do |appsflyer|
appsflyer.source_files = 'Swiftlytics/AppsFlyer/**/*'
appsflyer.dependency 'AppsFlyerFramework'
end
See Swiftlytics/AppsFlyer/AppsFlyerAnalyticsProvider for an example
Be sure to import the subspec in Example/Podfile, e.g.:
pod 'Swiftlytics/Facebook', :path => '../'
and then pod install
Swiftlytics is available under the MIT license. See the LICENSE file for more info.