This package contains a unified API for analytics purposes.
To install the analytics framework just add this line to the dependencies section in the Package.swift
.package(url: "https://github.com/kkla320/Tracking.git", from: "0.3.0")
After that you just need to add the package as a depency in the corresponding target.
.target(
name: "myProject",
dependencies: [
"Tracking"
])
First you have to import the framework
import Tracking
At the start of your app, you have to initialize the Analytics system
let myAnalyticsHandler = // ...
let myAnalyticsFilter = // ...
Analytics.bootstrap([myAnalyticsHandler], filters: [myAnalyticsFilter])
The you can just call the shared instance of Analytics
let myEvent = // ...
Analytics.shared.log(event: myEvent)