To run the example project, clone the repo, and run pod install
from the Example directory first.
import Afflatus
let Afflatus: AnalyticsProvider = MultiAnalyticsProvider(providers: [
FirebaseAnalyticsProvider(priority: 3), //requires GoogleServices.info
FacebookAnalyticsProvider(priority: 2),
AppsFlyerAnalyticsProvider(priority: 1, devKey: "YOUR_DEV_KEY", appId: "YOUR_APP_ID")
])
See Example/Afflatus/AppDelegate.swift
struct MemoryWarningEvent: AnalyticsEventConvertible {
let name = "memory_warning"
let count: UInt
}
...
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
count += 1
Afflatus.trackEvent(MemoryWarningEvent(count: count))
}
Afflatus.setUserId(UUID().uuidString) // your persistent database value in production
Afflatus.setUserProperty(name: "name", withValue: "Sandy")
Tested on Xcode 9.4.1, Swift 4, Cocoapods 1.5.3
Afflatus 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 'Afflatus'
pod 'Afflatus/Firebase'
pod 'Afflatus/AppsFlyer'
pod 'Afflatus/Facebook'
s.subspec 'AppsFlyer' do |appsflyer|
appsflyer.source_files = 'Afflatus/AppsFlyer/**/*'
appsflyer.dependency 'AppsFlyerFramework'
end
See Afflatus/AppsFlyer/AppsFlyerAnalyticsProvider for an example
Be sure to import the subspec in Example/Podfile, e.g.:
pod 'Afflatus/Facebook', :path => '../'
and then pod install
Afflatus is available under the MIT license. See the LICENSE file for more info.