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
Copy file name to clipboardExpand all lines: README.md
+45-17Lines changed: 45 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ The Clickstream SDK supports iOS 13+.
20
20
21
21
Clickstream requires Xcode 13.4 or higher to build.
22
22
23
-
**1.Add Package**
23
+
### 1.Add Package
24
24
25
25
We use **Swift Package Manager** to distribute Clickstream Swift SDK, open your project in Xcode and select **File > Add Pckages**.
26
26
@@ -30,7 +30,7 @@ Enter the Clickstream Library for Swift GitHub repo URL (`https://github.com/aws
30
30
31
31

32
32
33
-
**2.Parameter configuration**
33
+
### 2.Parameter configuration
34
34
35
35
Downlod your `amplifyconfiguration.json` file from your Clickstream solution control plane, and paste it to your project root folder:
36
36
@@ -62,15 +62,15 @@ Your `appId` and `endpoint` are already set up in it, here's an explanation of e
62
62
-**autoFlushEventsInterval**: event sending interval, the default is `10s`
63
63
-**isTrackAppExceptionEvents**: whether auto track exception event in app, default is `false`
64
64
65
-
**3.Initialize the SDK**
65
+
### 3.Initialize the SDK
66
66
67
67
Once you have configured the parameters, you need to initialize it in your app delegate's `application(_:didFinishLaunchingWithOptions:)` lifecycle method:
68
68
69
+
#### 3.1 Initialize the SDK with default configuration
assertionFailure("Fail to initialize ClickstreamAnalytics: \(error)")
101
+
}
102
+
returntrue
103
+
}
104
+
```
105
+
106
+
By default, we will use the configurations in `amplifyconfiguration.json` file. If you add a custom configuration, the added configuration items will override the default values.
107
+
108
+
You can also add all the configuration parameters you need in the `initSDK` method without using the `amplifyconfiguration.json` file.
109
+
110
+
#### 3.3 SwiftUI configuration
83
111
If your project is developed with SwiftUI, you need to create an application delegate and attach it to your `App` through `UIApplicationDelegateAdaptor`.
84
112
85
113
```swift
@@ -94,24 +122,24 @@ struct YourApp: App {
94
122
}
95
123
```
96
124
97
-
You also need to disable swzzling by setting `configuration.isTrackScreenViewEvents = false`, see the next configuration steps.
125
+
Clickstream Swift SDK depends on method swizzling to automatically record screen views. SwiftUI apps must [record screen view events manually](#record-screen-view-events-manually), and disable automatic tracking of screen view events by setting `configuration.withTrackScreenViewEvents(false)` when the SDK is initialized.
98
126
99
-
**4.Configure the SDK**
127
+
### 4. Update Configuration
100
128
101
129
```swift
102
130
importClickstream
103
131
104
-
//config the sdk after initialize.
132
+
//configure the sdk after initialize.
105
133
do {
106
-
var configuration =try ClickstreamAnalytics.getClickstreamConfiguration()
0 commit comments