You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have an app + widget(s), by default one visit per day per target (app, widget) is treated as separate 'visitors'. This means that if you have an app with a small and medium widget, one person using the core app and both widgets will show in your SimpleAnalytics dashboard as 3 visitors. However, you can ensure one visitor only appears once per day by creating an App Group in your Xcode project. Create a new App Group ([instructions](https://developer.apple.com/documentation/xcode/configuring-app-groups)) in each of your targets (Project > Targets > Signing & Capabilities > App Groups) with the same name. Use this app group name in your SimpleAnalytics instance.
65
+
```swift
66
+
let simpleAnalytics =SimpleAnalytics(hostname: "app.simpleanalytics.com", sharedDefaultsSuiteName: "group.com.simpleanlytics.app")
67
+
```
68
+
63
69
## Examples
64
70
### SwiftUI example
65
71
In SwiftUI, a good place to put the Pageview tracking code is in your view `.onAppear{}` modifier.
/// Create the SimpleAnalytics instance that can be used to trigger events and pageviews.
56
+
/// - Parameter hostname: The hostname as found in SimpleAnalytics, without `https://`
57
+
/// - Parameter: sharedDefaultsSuiteName: When extensions (such as a main app and widget) have a set of sharedDefaults (using an App Group) that unique user can be counted once using this (instead of two or more times when using app and widget, etc.)
0 commit comments