Skip to content

Commit

Permalink
Add documentation to setup delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
waliid committed Jan 24, 2025
1 parent d6dc305 commit b6244b1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Sources/Analytics/Analytics.docc/user-consent-article.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,25 @@ extension AppDelegate: AnalyticsDataSource {
In the example above user consent has been hardcoded but a real implementation should check local user consent data to provide parameters matching the current user choices.

> Warning: ``AnalyticsDataSource`` methods are called with each event sent. Your implementation should therefore be as efficient as possible.
### Setup an analytics delegate

If you want to hook to analytics events to potential track something else like google analytics or blabla or blabla you can do like so:

```swift
final class AppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
let configuration = Analytics.Configuration(
vendor: .SRF,
sourceKey: .productionSourceKey,
appSiteName: "app-site-name"
)
try? Analytics.shared.start(with: configuration, delegate: self)

// ...
}
}
```

0 comments on commit b6244b1

Please sign in to comment.