@adshift/react-native-plugin 2.1.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdShiftReactNativePlugin.podspec +20 -4
- package/CHANGELOG.md +57 -8
- package/README.md +131 -74
- package/android/build.gradle +3 -2
- package/android/consumer-rules.pro +2 -21
- package/android/src/main/AndroidManifest.xml +14 -1
- package/android/src/main/java/com/adshift/reactnativeplugin/ActivityIntents.kt +307 -0
- package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginModule.kt +90 -153
- package/android/src/test/java/com/adshift/reactnativeplugin/ConsentSnapshotTest.kt +0 -20
- package/android/src/test/java/com/adshift/reactnativeplugin/DeepLinkDeliveryTest.kt +40 -7
- package/android/src/test/java/com/adshift/reactnativeplugin/InitializeOrderingTest.kt +51 -5
- package/android/src/test/java/com/adshift/reactnativeplugin/IntentLinkDedupTest.kt +0 -5
- package/android/src/test/java/com/adshift/reactnativeplugin/LaunchIntentForwardingTest.kt +21 -11
- package/android/src/test/java/com/adshift/reactnativeplugin/LaunchLinkRecordTest.kt +420 -0
- package/android/src/test/java/com/adshift/reactnativeplugin/ModuleTestSupport.kt +97 -25
- package/android/src/test/java/com/adshift/reactnativeplugin/StartVerdictTest.kt +0 -4
- package/ios/AdShiftReactNativePlugin.h +0 -12
- package/ios/AdShiftReactNativePlugin.mm +7 -14
- package/ios/AdShiftReactNativePluginHelper.swift +38 -73
- package/ios/Core/BridgeRules.swift +42 -30
- package/lib/commonjs/Adshift.js +100 -284
- package/lib/commonjs/Adshift.js.map +1 -1
- package/lib/commonjs/NativeAdShiftReactNativePlugin.js +2 -11
- package/lib/commonjs/NativeAdShiftReactNativePlugin.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jest/index.js +6 -18
- package/lib/commonjs/jest/index.js.map +1 -1
- package/lib/commonjs/nativeSdkVersions.js +4 -6
- package/lib/commonjs/nativeSdkVersions.js.map +1 -1
- package/lib/commonjs/types/AdshiftAdRevenue.js +0 -24
- package/lib/commonjs/types/AdshiftAdRevenue.js.map +1 -1
- package/lib/commonjs/types/AdshiftConfig.js +11 -23
- package/lib/commonjs/types/AdshiftConfig.js.map +1 -1
- package/lib/commonjs/types/AdshiftConsent.js +9 -45
- package/lib/commonjs/types/AdshiftConsent.js.map +1 -1
- package/lib/commonjs/types/AdshiftConsentSnapshot.js +5 -24
- package/lib/commonjs/types/AdshiftConsentSnapshot.js.map +1 -1
- package/lib/commonjs/types/AdshiftDeepLink.js +50 -33
- package/lib/commonjs/types/AdshiftDeepLink.js.map +1 -1
- package/lib/commonjs/types/AdshiftError.js +7 -27
- package/lib/commonjs/types/AdshiftError.js.map +1 -1
- package/lib/commonjs/types/AdshiftEventParam.js +4 -38
- package/lib/commonjs/types/AdshiftEventParam.js.map +1 -1
- package/lib/commonjs/types/AdshiftEventType.js +1 -39
- package/lib/commonjs/types/AdshiftEventType.js.map +1 -1
- package/lib/commonjs/types/AdshiftThirdPartySharing.js +7 -38
- package/lib/commonjs/types/AdshiftThirdPartySharing.js.map +1 -1
- package/lib/commonjs/types/index.js +12 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/Adshift.js +101 -285
- package/lib/module/Adshift.js.map +1 -1
- package/lib/module/NativeAdShiftReactNativePlugin.js +2 -12
- package/lib/module/NativeAdShiftReactNativePlugin.js.map +1 -1
- package/lib/module/index.js +2 -47
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest/index.js +7 -19
- package/lib/module/jest/index.js.map +1 -1
- package/lib/module/nativeSdkVersions.js +4 -6
- package/lib/module/nativeSdkVersions.js.map +1 -1
- package/lib/module/types/AdshiftAdRevenue.js +0 -24
- package/lib/module/types/AdshiftAdRevenue.js.map +1 -1
- package/lib/module/types/AdshiftConfig.js +10 -23
- package/lib/module/types/AdshiftConfig.js.map +1 -1
- package/lib/module/types/AdshiftConsent.js +9 -45
- package/lib/module/types/AdshiftConsent.js.map +1 -1
- package/lib/module/types/AdshiftConsentSnapshot.js +5 -24
- package/lib/module/types/AdshiftConsentSnapshot.js.map +1 -1
- package/lib/module/types/AdshiftDeepLink.js +49 -32
- package/lib/module/types/AdshiftDeepLink.js.map +1 -1
- package/lib/module/types/AdshiftError.js +7 -28
- package/lib/module/types/AdshiftError.js.map +1 -1
- package/lib/module/types/AdshiftEventParam.js +4 -38
- package/lib/module/types/AdshiftEventParam.js.map +1 -1
- package/lib/module/types/AdshiftEventType.js +1 -39
- package/lib/module/types/AdshiftEventType.js.map +1 -1
- package/lib/module/types/AdshiftThirdPartySharing.js +7 -38
- package/lib/module/types/AdshiftThirdPartySharing.js.map +1 -1
- package/lib/module/types/index.js +2 -2
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/Adshift.d.ts +68 -184
- package/lib/typescript/commonjs/src/Adshift.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts +18 -35
- package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -34
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/jest/index.d.ts +9 -21
- package/lib/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts +4 -6
- package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts +0 -24
- package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts +35 -39
- package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts +9 -49
- package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts +10 -28
- package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts +55 -39
- package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftError.d.ts +7 -26
- package/lib/typescript/commonjs/src/types/AdshiftError.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts +3 -19
- package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftEventType.d.ts +1 -23
- package/lib/typescript/commonjs/src/types/AdshiftEventType.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts +7 -38
- package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/index.d.ts +3 -3
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/Adshift.d.ts +68 -184
- package/lib/typescript/module/src/Adshift.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts +18 -35
- package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -34
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/jest/index.d.ts +9 -21
- package/lib/typescript/module/src/jest/index.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeSdkVersions.d.ts +4 -6
- package/lib/typescript/module/src/nativeSdkVersions.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts +0 -24
- package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftConfig.d.ts +35 -39
- package/lib/typescript/module/src/types/AdshiftConfig.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftConsent.d.ts +9 -49
- package/lib/typescript/module/src/types/AdshiftConsent.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts +10 -28
- package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts +55 -39
- package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftError.d.ts +7 -26
- package/lib/typescript/module/src/types/AdshiftError.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftEventParam.d.ts +3 -19
- package/lib/typescript/module/src/types/AdshiftEventParam.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftEventType.d.ts +1 -23
- package/lib/typescript/module/src/types/AdshiftEventType.d.ts.map +1 -1
- package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts +7 -38
- package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts.map +1 -1
- package/lib/typescript/module/src/types/index.d.ts +3 -3
- package/lib/typescript/module/src/types/index.d.ts.map +1 -1
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +11 -1
- package/src/Adshift.ts +118 -285
- package/src/NativeAdShiftReactNativePlugin.ts +19 -47
- package/src/index.tsx +7 -46
- package/src/jest/index.ts +11 -20
- package/src/nativeSdkVersions.ts +4 -6
- package/src/types/AdshiftAdRevenue.ts +0 -24
- package/src/types/AdshiftConfig.ts +48 -55
- package/src/types/AdshiftConsent.ts +9 -49
- package/src/types/AdshiftConsentSnapshot.ts +11 -38
- package/src/types/AdshiftDeepLink.ts +87 -39
- package/src/types/AdshiftError.ts +7 -26
- package/src/types/AdshiftEventParam.ts +4 -38
- package/src/types/AdshiftEventType.ts +1 -39
- package/src/types/AdshiftThirdPartySharing.ts +7 -38
- package/src/types/index.ts +9 -2
- package/src/version.ts +1 -1
- package/vendor/ios/AdshiftSDK.files.json +30 -0
- package/vendor/ios/AdshiftSDK.xcframework/Info.plist +44 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/AdshiftSDK +0 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Headers/AdshiftSDK-Swift.h +315 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Info.plist +0 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.abi.json +18729 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +414 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.swiftinterface +414 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/module.modulemap +4 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/PrivacyInfo.xcprivacy +132 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/AdshiftSDK +0 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Headers/AdshiftSDK-Swift.h +626 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Info.plist +0 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +18729 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +414 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +414 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +18729 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +414 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +414 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/module.modulemap +4 -0
- package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/PrivacyInfo.xcprivacy +132 -0
package/README.md
CHANGED
|
@@ -27,10 +27,11 @@ Official AdShift SDK for React Native. The plugin wraps the native [iOS SDK](htt
|
|
|
27
27
|
- [Expo](#expo)
|
|
28
28
|
- [Testing](#testing)
|
|
29
29
|
- [Development Notes](#development-notes)
|
|
30
|
+
- [Upgrading from 3.0](#upgrading-from-30)
|
|
31
|
+
- [Upgrading from 2.x](#upgrading-from-2x)
|
|
30
32
|
- [Upgrading from 1.x](#upgrading-from-1x)
|
|
31
33
|
- [Example App](#example-app)
|
|
32
34
|
- [Troubleshooting](#troubleshooting)
|
|
33
|
-
- [For Maintainers](#for-maintainers)
|
|
34
35
|
- [Support](#support)
|
|
35
36
|
|
|
36
37
|
---
|
|
@@ -53,6 +54,8 @@ Each plugin release pins exact native SDK versions. Do not override them in your
|
|
|
53
54
|
|
|
54
55
|
| Plugin | Android SDK | iOS SDK |
|
|
55
56
|
|---|---|---|
|
|
57
|
+
| 3.1.x | `com.adshift:android-sdk:4.2.0` | `AdshiftSDK 3.1.0` |
|
|
58
|
+
| 3.0.x | `com.adshift:android-sdk:4.1.0` | `AdshiftSDK 3.0.0` |
|
|
56
59
|
| 2.1.x | `com.adshift:android-sdk:3.2.0` | `AdshiftSDK 2.4.0` |
|
|
57
60
|
| 2.0.x | `com.adshift:android-sdk:3.1.0` | `AdshiftSDK 2.2.0` |
|
|
58
61
|
|
|
@@ -72,9 +75,11 @@ yarn add @adshift/react-native-plugin
|
|
|
72
75
|
cd ios && pod install
|
|
73
76
|
```
|
|
74
77
|
|
|
78
|
+
The AdShift iOS SDK comes inside the plugin package, so `pod install` fetches nothing for it. Do not add the SDK to your app yourself, neither through CocoaPods (`pod 'AdshiftSDK'`) nor through Swift Package Manager. Your app's own native code can still `import AdshiftSDK`.
|
|
79
|
+
|
|
75
80
|
Then add the two `RCTLinkingManager` handlers to `AppDelegate.swift` (see [Platform Setup → iOS](#ios)); the plugin relies on them to receive links while the app is running.
|
|
76
81
|
|
|
77
|
-
**Android** —
|
|
82
|
+
**Android** — the module autolinks. See [Platform Setup → Android](#android) for backup rules, the `AD_ID` permission and the one `MainActivity` override deep links need.
|
|
78
83
|
|
|
79
84
|
---
|
|
80
85
|
|
|
@@ -126,7 +131,7 @@ subscription.remove();
|
|
|
126
131
|
|
|
127
132
|
### `Adshift.initialize(config)`
|
|
128
133
|
|
|
129
|
-
Configures the SDK. Call once; the first configuration is kept and later calls are ignored.
|
|
134
|
+
Configures the SDK. Call once; the first configuration is kept and later calls are ignored. It never throws: a missing `apiKey` or a malformed option is reported through `config.onError` as `INVALID_ARGUMENT` and leaves the SDK uninitialized.
|
|
130
135
|
|
|
131
136
|
See [`AdshiftConfig`](#adshiftconfig) for every option.
|
|
132
137
|
|
|
@@ -143,9 +148,9 @@ interface StartResult {
|
|
|
143
148
|
}
|
|
144
149
|
```
|
|
145
150
|
|
|
146
|
-
- The API key is verified with the AdShift backend in the background. `apiKeyValidationStatus` is the verdict at the moment `start()` resolved: `valid`, `invalid`, or `pending` while the answer is not in. `config.onError` reports `INVALID_API_KEY` when `start()` itself returns `invalid`. On iOS the verdict usually arrives after `start()` resolved, so a rejected key is reported by the next `start()`; on Android `start()` waits up to 5 s for it.
|
|
151
|
+
- The API key is verified with the AdShift backend in the background. `apiKeyValidationStatus` is the verdict at the moment `start()` resolved: `valid`, `invalid`, or `pending` while the answer is not in. `config.onError` reports `INVALID_API_KEY` when `start()` itself returns `invalid`. On iOS the verdict usually arrives after `start()` resolved, so a rejected key is reported by the next `start()`; on Android `start()` waits up to 5 s for it.
|
|
147
152
|
- A device excluded from tracking resolves `{ success: false, errorCode: 'OPTED_OUT' }`.
|
|
148
|
-
- On iOS `start()` resolves after the local set-up and does not wait for the ATT decision or the SKAdNetwork configuration. With `waitForATTBeforeStart`
|
|
153
|
+
- On iOS `start()` resolves after the local set-up and does not wait for the ATT decision or the SKAdNetwork configuration. With `waitForATTBeforeStart` events are delivered after the ATT decision, at the latest after `attTimeoutMs`.
|
|
149
154
|
- Calling `start()` again while started resolves `{ success: true }` immediately. Calling it before `initialize()` resolves `{ success: false, errorCode: 'NOT_INITIALIZED' }`.
|
|
150
155
|
- Everything queued with `trackEvent`, `trackPurchase` and `logAdRevenue` between `initialize()` and a successful `start()` is dispatched in order when `start()` succeeds. If the start failed for a reason retrying cannot fix — `INVALID_API_KEY`, `OPTED_OUT`, `NOT_INITIALIZED` — the queued promises reject with that code. If it failed for any other reason, they keep waiting for the next `start()`, so the data survives a start that failed while the device was offline. Queued promises stay pending until some `start()` finishes, which is why `start()` belongs on every launch path.
|
|
151
156
|
|
|
@@ -153,7 +158,7 @@ interface StartResult {
|
|
|
153
158
|
|
|
154
159
|
Pauses delivery. Tracking calls reject with `NOT_STARTED` until the next successful `start()`. This is not an opt-out; opt-out is configured on the AdShift side.
|
|
155
160
|
|
|
156
|
-
|
|
161
|
+
Links keep reaching `onDeepLink` after `stop()`, so your app can still route, but their clicks are not counted, and a short link arrives as tapped, without `deepLinkValue`. Nothing is sent until the next `start()`. Configuration setters and `refreshConsent()` also keep working, so consent changes apply while delivery is paused. Calls queued before the interrupted `start()` reject with `NOT_STARTED`.
|
|
157
162
|
|
|
158
163
|
### `Adshift.isStarted(): boolean`
|
|
159
164
|
|
|
@@ -166,7 +171,7 @@ The AdShift device identifier; `null` before `initialize()`.
|
|
|
166
171
|
### `Adshift.getInfo()`
|
|
167
172
|
|
|
168
173
|
```typescript
|
|
169
|
-
{ platform: 'ios' | 'android', version: '
|
|
174
|
+
{ platform: 'ios' | 'android', version: '3.1.0', nativeSdkVersions: { android: '4.2.0', ios: '3.1.0' } }
|
|
170
175
|
```
|
|
171
176
|
|
|
172
177
|
---
|
|
@@ -186,7 +191,7 @@ await Adshift.trackEvent('custom_event');
|
|
|
186
191
|
|
|
187
192
|
`values` accepts strings, numbers and booleans (no nested objects). The promise resolves once the SDK has accepted the event; delivery is asynchronous and survives offline periods. Rejections use [`AdshiftError`](#errors).
|
|
188
193
|
|
|
189
|
-
`app_install` and `app_open` are reserved — the SDK sends them itself, so passing them here rejects with `INVALID_ARGUMENT
|
|
194
|
+
`app_install` and `app_open` are reserved — the SDK sends them itself, so passing them here rejects with `INVALID_ARGUMENT`.
|
|
190
195
|
|
|
191
196
|
### `Adshift.trackPurchase(params): Promise<void>`
|
|
192
197
|
|
|
@@ -214,7 +219,7 @@ await Adshift.trackPurchase({
|
|
|
214
219
|
| Location | `LocationChanged`, `LocationCoordinates` |
|
|
215
220
|
| Other | `OrderId`, `CustomerSegment` |
|
|
216
221
|
|
|
217
|
-
`getAllEventTypes()` returns the
|
|
222
|
+
`getAllEventTypes()` returns the event names as an array.
|
|
218
223
|
|
|
219
224
|
### Standard parameter names
|
|
220
225
|
|
|
@@ -253,7 +258,7 @@ await Adshift.logAdRevenue({
|
|
|
253
258
|
});
|
|
254
259
|
```
|
|
255
260
|
|
|
256
|
-
`mediationNetwork` must be an `AdshiftMediationNetwork` value (`AppLovinMAX`, `GoogleAdMob`, `IronSource`, `Chartboost`, `TopOn`, `TradPlus`, `AdMost`, `Appodeal`, `Fyber`, `Unity`, `Yandex`, `CustomMediation`, `DirectMonetization`, `Other`). `revenue` is the value of one impression and must be positive
|
|
261
|
+
`mediationNetwork` must be an `AdshiftMediationNetwork` value (`AppLovinMAX`, `GoogleAdMob`, `IronSource`, `Chartboost`, `TopOn`, `TradPlus`, `AdMost`, `Appodeal`, `Fyber`, `Unity`, `Yandex`, `CustomMediation`, `DirectMonetization`, `Other`). `revenue` is the value of one impression and must be positive. An impression above 10 USD is not recorded; on Android the limit is 10 in whatever currency you pass.
|
|
257
262
|
|
|
258
263
|
---
|
|
259
264
|
|
|
@@ -261,8 +266,10 @@ await Adshift.logAdRevenue({
|
|
|
261
266
|
|
|
262
267
|
### The contract
|
|
263
268
|
|
|
264
|
-
- Every link that opens the app and reaches the SDK — direct, deferred (first launch after install) and push — produces
|
|
265
|
-
- `status === 'found'` means
|
|
269
|
+
- Every link that opens the app and reaches the SDK — direct, deferred (first launch after install) and push — produces an `onDeepLink` result, and each result is delivered once.
|
|
270
|
+
- **Navigate only on `status === 'found'`.** `found` means a RightLink link — your `*.rightlink.me` host, a domain in `brandedDomains`, or your app's scheme wrapping one (`yourapp://rightlink?as_rl=<the link, percent-encoded>`) — or a deferred deep link with a value. Validate `deepLinkValue` before you use it: anyone can write a link.
|
|
271
|
+
- Any other URL, your app's own links included, comes back `notFound` with the URL in `deepLink` and no `params`. Route your own links from there.
|
|
272
|
+
- `error` means "not yet": a short link that could not be resolved, for example without a network. `found` follows once the link resolves.
|
|
266
273
|
- Results are delivered only through `onDeepLink`. `handleDeepLink()` and `handlePushNotification()` resolve when the SDK has accepted the input.
|
|
267
274
|
|
|
268
275
|
### `Adshift.onDeepLink(callback): DeepLinkSubscription`
|
|
@@ -270,40 +277,53 @@ await Adshift.logAdRevenue({
|
|
|
270
277
|
```typescript
|
|
271
278
|
useEffect(() => {
|
|
272
279
|
const subscription = Adshift.onDeepLink((deepLink) => {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
280
|
+
switch (deepLink.status) {
|
|
281
|
+
case AdshiftDeepLinkStatus.Found:
|
|
282
|
+
if (deepLink.deepLinkValue === 'product') {
|
|
283
|
+
navigate('Product', { id: deepLink.params?.product_id });
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
case AdshiftDeepLinkStatus.NotFound:
|
|
287
|
+
// your own links: route on deepLink.deepLink
|
|
288
|
+
break;
|
|
289
|
+
case AdshiftDeepLinkStatus.Error:
|
|
290
|
+
// carry on without a deep link; `found` can still follow
|
|
291
|
+
break;
|
|
276
292
|
}
|
|
277
293
|
});
|
|
278
294
|
return () => subscription.remove();
|
|
279
295
|
}, []);
|
|
280
296
|
```
|
|
281
297
|
|
|
282
|
-
- Safe before `initialize()`.
|
|
298
|
+
- Safe before `initialize()`. Results that arrive while no listener is registered wait and are delivered to the first listener.
|
|
283
299
|
- Listeners are called on the JS thread; an exception in one listener does not affect the others. `remove()` is idempotent.
|
|
284
300
|
|
|
285
301
|
```typescript
|
|
286
302
|
interface AdshiftDeepLink {
|
|
287
|
-
deepLink?: string; // the
|
|
303
|
+
deepLink?: string; // the link as opened, a short link expanded
|
|
288
304
|
deepLinkValue?: string; // deep_link_value for routing
|
|
289
|
-
params?: Record<string, string>; // query
|
|
305
|
+
params?: Record<string, string>; // query of a RightLink link, your own keys included
|
|
290
306
|
isDeferred: boolean; // first launch after install
|
|
291
|
-
isFirstSession?: boolean; //
|
|
307
|
+
isFirstSession?: boolean; // the first session after install
|
|
292
308
|
status: AdshiftDeepLinkStatus; // Found | NotFound | Error
|
|
293
309
|
errorMessage?: string; // with Error; wording differs per platform
|
|
310
|
+
source?: AdshiftDeepLinkSource; // how the link reached the app
|
|
311
|
+
clickId?: string; // the click this open was attributed to
|
|
312
|
+
matchGuaranteed?: boolean; // iOS, see below
|
|
294
313
|
deepLinkSub1?: string; /* … */ deepLinkSub5?: string;
|
|
295
314
|
}
|
|
296
315
|
```
|
|
297
316
|
|
|
317
|
+
- `source` is `ul` on iOS and `app_link` on Android for a Universal Link or App Link (or a link you passed in yourself), `scheme`, `cta` (the open-in-app button of a RightLink page), `push`, `deferred` or `foreign` (a web link that is not a RightLink link); iOS adds `aak` (an AdAttributionKit re-engagement open) and Android `meta_applink`.
|
|
318
|
+
- `matchGuaranteed` is `false` when a deferred result is not certain to belong to this user: route them, but do not sign them in or grant a reward because of it.
|
|
319
|
+
|
|
298
320
|
### Automatic forwarding (default)
|
|
299
321
|
|
|
300
322
|
With `autoHandleDeepLinks: true` (the default) you write no linking code:
|
|
301
323
|
|
|
302
|
-
- **Android** — the plugin reads the launch Intent and every new Intent (App Links, custom schemes, push taps that carry `as_push_link`).
|
|
324
|
+
- **Android** — the plugin reads the launch Intent and every new Intent (App Links, custom schemes, push taps that carry `as_push_link`). A relaunch from Recents or the launcher, or an Activity the system re-created (a rotation, a return after the process was killed), does not deliver its link again. A link that opened the app still arrives when Android killed the process before `initialize()`.
|
|
303
325
|
- **iOS** — the plugin uses React Native's `Linking` (`getInitialURL` and the `url` event). Your `AppDelegate.swift` must forward URLs to `RCTLinkingManager` (see [Platform Setup → iOS](#ios)); without it links opened while the app is running never reach JavaScript.
|
|
304
326
|
|
|
305
|
-
`start()` waits (up to 3 s) for the launch URL to be handed to the SDK, so the first `app_open` carries the click parameters.
|
|
306
|
-
|
|
307
327
|
### Manual forwarding
|
|
308
328
|
|
|
309
329
|
Set `autoHandleDeepLinks: false` and forward URLs yourself:
|
|
@@ -312,11 +332,24 @@ Set `autoHandleDeepLinks: false` and forward URLs yourself:
|
|
|
312
332
|
await Adshift.handleDeepLink(url); // resolves once accepted; result arrives via onDeepLink
|
|
313
333
|
```
|
|
314
334
|
|
|
315
|
-
Rejects with `NOT_INITIALIZED` or `INVALID_ARGUMENT` (empty or malformed URL). If you keep an old `Linking → handleDeepLink` handler while automatic forwarding is on, the
|
|
335
|
+
Rejects with `NOT_INITIALIZED` or `INVALID_ARGUMENT` (empty or malformed URL). If you keep an old `Linking → handleDeepLink` handler while automatic forwarding is on, the link is still handled once.
|
|
316
336
|
|
|
317
337
|
### Deferred deep links
|
|
318
338
|
|
|
319
|
-
On the first launch after install the SDK
|
|
339
|
+
On the first launch after install the SDK looks up the deferred deep link and answers through `onDeepLink` with `isDeferred: true` within 5 seconds of `start()`: the link, `notFound` or `error`. With `waitForATTBeforeStart` on iOS the 5 seconds count from the ATT answer. Nothing to configure.
|
|
340
|
+
|
|
341
|
+
On iOS a deferred result has no `deepLink`: route on `deepLinkValue` and `deepLinkSub1`…`deepLinkSub5`, which `params` also holds as `deep_link_sub1`…`deep_link_sub5` on both platforms. There is no deferred deep link when the user denied ad storage or ad user data in your consent.
|
|
342
|
+
|
|
343
|
+
**Clipboard (iOS)** — for RightLink templates with the clipboard option, set `deferredDeepLinkClipboard` in `initialize()`:
|
|
344
|
+
|
|
345
|
+
- `'prompt'` — the SDK reads the clipboard once per install; iOS asks the user to allow the paste.
|
|
346
|
+
- `'pasteControl'` — your onboarding shows `UIPasteControl`, which pastes without asking, and you pass on what was pasted:
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
Adshift.handlePastedDeepLink(pastedUrl); // null when the user skipped
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Call it on every way out of onboarding: the first launch's deferred deep link waits for it. `UIPasteControl` is a native view you add to your app yourself; the plugin ships none.
|
|
320
353
|
|
|
321
354
|
---
|
|
322
355
|
|
|
@@ -347,7 +380,7 @@ notifee.onForegroundEvent(({ type, detail }) => {
|
|
|
347
380
|
});
|
|
348
381
|
```
|
|
349
382
|
|
|
350
|
-
`handlePushNotification` resolves `true` when the payload carried an AdShift link (the result arrives through `onDeepLink`). Only taps should be forwarded, not deliveries. Call it before `start()` when the payload is known at launch, so the
|
|
383
|
+
`handlePushNotification` resolves `true` when the payload carried an AdShift link (the result arrives through `onDeepLink`). The link must be a RightLink link with `pid` and `c` (or `campaign`), or a RightLink short link. Only taps should be forwarded, not deliveries. Call it before `start()` when the payload is known at launch, so the launch is attributed to the push.
|
|
351
384
|
|
|
352
385
|
---
|
|
353
386
|
|
|
@@ -358,7 +391,7 @@ Set consent on every launch, before `start()`, and again whenever the user chang
|
|
|
358
391
|
### Manual consent
|
|
359
392
|
|
|
360
393
|
```typescript
|
|
361
|
-
// User subject to GDPR; omitted flags are "not decided"
|
|
394
|
+
// User subject to GDPR; omitted flags are "not decided"
|
|
362
395
|
Adshift.setConsentData(
|
|
363
396
|
AdshiftConsent.forGDPRUser({
|
|
364
397
|
hasConsentForDataUsage: true,
|
|
@@ -367,7 +400,7 @@ Adshift.setConsentData(
|
|
|
367
400
|
})
|
|
368
401
|
);
|
|
369
402
|
|
|
370
|
-
// User not subject to GDPR: everything is permitted
|
|
403
|
+
// User not subject to GDPR: everything is permitted
|
|
371
404
|
Adshift.setConsentData(AdshiftConsent.forNonGDPRUser());
|
|
372
405
|
```
|
|
373
406
|
|
|
@@ -385,10 +418,9 @@ const snapshot: ConsentSnapshot = await Adshift.refreshConsent();
|
|
|
385
418
|
|
|
386
419
|
### GPP (US state privacy)
|
|
387
420
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
device; a US opt-out limits what may be done with an event afterwards.
|
|
421
|
+
`enableGPPDataCollection` reads the IAB GPP string the CMP wrote, in addition to
|
|
422
|
+
the GDPR consent, including one set through `setConsentData()`. It does not gate
|
|
423
|
+
the advertising identifier.
|
|
392
424
|
|
|
393
425
|
```typescript
|
|
394
426
|
Adshift.enableGPPDataCollection(true); // before start()
|
|
@@ -401,10 +433,10 @@ snapshot.gppPresent; // true once a GPP string is on the device
|
|
|
401
433
|
|
|
402
434
|
### Third-party sharing
|
|
403
435
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
436
|
+
Unlike consent, nothing said here means sharing is allowed. So state it only
|
|
437
|
+
once the user has actually been asked — an `allowed()` set at startup as a
|
|
438
|
+
default records a declaration the user never made, and events already sent
|
|
439
|
+
cannot be recalled when a real answer arrives.
|
|
408
440
|
|
|
409
441
|
```typescript
|
|
410
442
|
// The user asked not to have their data passed on
|
|
@@ -417,8 +449,6 @@ Adshift.setThirdPartySharing(AdshiftThirdPartySharing.allowed());
|
|
|
417
449
|
Adshift.clearThirdPartySharing();
|
|
418
450
|
```
|
|
419
451
|
|
|
420
|
-
Nothing is gated on the device either way; the answer travels with the events.
|
|
421
|
-
|
|
422
452
|
```typescript
|
|
423
453
|
interface ConsentSnapshot {
|
|
424
454
|
source: 'manual' | 'tcf' | 'gpp' | 'none';
|
|
@@ -434,17 +464,14 @@ interface ConsentSnapshot {
|
|
|
434
464
|
}
|
|
435
465
|
```
|
|
436
466
|
|
|
437
|
-
`source` names what decided
|
|
438
|
-
|
|
439
|
-
whatever `source` says, and neither is displaced by calling `setConsentData()`.
|
|
467
|
+
`source` names what decided GDPR consent; manual consent outranks TCF. GPP and
|
|
468
|
+
the sharing answer are separate, and `setConsentData()` does not replace them.
|
|
440
469
|
|
|
441
|
-
`cmpDetected`
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
never wired up, while `true` with `source: 'none'` means it ran and the user has
|
|
445
|
-
not answered yet, which resolves itself once they do.
|
|
470
|
+
`cmpDetected` tells a CMP the user has not answered yet from no CMP at all:
|
|
471
|
+
`false` when you expect a CMP means it never ran or was never wired up, while
|
|
472
|
+
`true` with `source: 'none'` means it ran and the user has not answered yet.
|
|
446
473
|
|
|
447
|
-
`adIdentifiersAllowed` answers whether consent lets the SDK
|
|
474
|
+
`adIdentifiersAllowed` answers whether consent lets the SDK use the advertising identifier (GAID or OAID on Android, IDFA on iOS); the `adshift_device_id` is never affected. The platforms judge the flags by different rules, so read this field instead of comparing the flags yourself.
|
|
448
475
|
|
|
449
476
|
---
|
|
450
477
|
|
|
@@ -457,13 +484,15 @@ not answered yet, which resolves itself once they do.
|
|
|
457
484
|
| `apiKey` | `string` | — | Required |
|
|
458
485
|
| `isDebug` | `boolean` | SDK default | Verbose native logging |
|
|
459
486
|
| `appOpenDebounceMs` | `number` | `10000` | Debounce for automatic `app_open` |
|
|
460
|
-
| `brandedDomains` | `string[]` | — |
|
|
487
|
+
| `brandedDomains` | `string[]` | — | Your own link domains; without it their links are `notFound` |
|
|
488
|
+
| `testMode` | `boolean` | `false` | Marks every click and event as test traffic, kept out of reports, postbacks and billing |
|
|
461
489
|
| `metaAppId` | `string` | — | Meta App Links parsing (Android) |
|
|
462
490
|
| `pushDeepLinkPaths` | `string[][]` | `[['as_push_link']]` | Extra key paths in push payloads |
|
|
463
491
|
| `autoHandleDeepLinks` | `boolean` | `true` | Automatic URL forwarding |
|
|
464
492
|
| `disableSKAN` | `boolean` | `false` | iOS |
|
|
465
493
|
| `waitForATTBeforeStart` | `boolean` | `false` | iOS; only when **your app** shows the ATT prompt |
|
|
466
494
|
| `attTimeoutMs` | `number` | `30000` | iOS; clamped to 5 000–120 000 |
|
|
495
|
+
| `deferredDeepLinkClipboard` | `'disabled' \| 'prompt' \| 'pasteControl'` | `'disabled'` | iOS; see [Deferred deep links](#deferred-deep-links) |
|
|
467
496
|
| `collectOaid` | `boolean` | `true` | Android; OAID on devices without Google Play services |
|
|
468
497
|
|
|
469
498
|
Only options you set are passed to the native SDK; everything else keeps the SDK default.
|
|
@@ -528,8 +557,8 @@ try {
|
|
|
528
557
|
| `NOT_INITIALIZED` | `initialize()` has not been called |
|
|
529
558
|
| `NOT_STARTED` | `stop()` was called; call `start()` |
|
|
530
559
|
| `INVALID_API_KEY` | The backend rejected the API key |
|
|
531
|
-
| `OPTED_OUT` | Tracking is
|
|
532
|
-
| `QUEUE_FULL` | More than 100 calls are waiting for `start()`, or the Android SDK
|
|
560
|
+
| `OPTED_OUT` | Tracking is turned off for this device |
|
|
561
|
+
| `QUEUE_FULL` | More than 100 calls are waiting for `start()`, or the Android SDK could not take the call |
|
|
533
562
|
| `INVALID_ARGUMENT` | A parameter failed validation |
|
|
534
563
|
| `UNKNOWN` | Anything else; see `userInfo.nativeCode` |
|
|
535
564
|
|
|
@@ -541,7 +570,7 @@ try {
|
|
|
541
570
|
|
|
542
571
|
### iOS
|
|
543
572
|
|
|
544
|
-
**1. Deployment target** — `platform :ios, '15.1'` or higher in `ios/Podfile` (React Native 0.82 already requires this). The plugin builds with the default static libraries, `use_frameworks! :linkage => :static` and dynamic frameworks.
|
|
573
|
+
**1. Deployment target** — `platform :ios, '15.1'` or higher in `ios/Podfile` (React Native 0.82 already requires this). The plugin builds with the default static libraries, `use_frameworks! :linkage => :static` and dynamic frameworks. It carries the AdShift iOS SDK; do not add `AdshiftSDK` yourself, neither through CocoaPods nor through Swift Package Manager.
|
|
545
574
|
|
|
546
575
|
**2. `AppDelegate.swift`** — forward URLs to React Native so `Linking` (and the plugin) receive them. The bare React Native template does not include these methods; **Expo projects need none of this** (see [Expo](#expo)):
|
|
547
576
|
|
|
@@ -590,13 +619,13 @@ func application(
|
|
|
590
619
|
|
|
591
620
|
The native SDK ships its own privacy manifest; the plugin adds no tracked APIs. For what to put in App Store Connect, see [Store Privacy Declarations](#store-privacy-declarations).
|
|
592
621
|
|
|
593
|
-
**6. Pod linkage** — the plugin is built in all three CocoaPods linkage modes: the React Native default, where pods are static libraries, plus `use_frameworks! :linkage => :static` and `use_frameworks! :linkage => :dynamic`. Nothing extra is needed on your side for any of them.
|
|
622
|
+
**6. Pod linkage** — the plugin is built in all three CocoaPods linkage modes, on the oldest supported and the newest React Native: the React Native default, where pods are static libraries, plus `use_frameworks! :linkage => :static` and `use_frameworks! :linkage => :dynamic`. Nothing extra is needed on your side for any of them.
|
|
594
623
|
|
|
595
624
|
### Android
|
|
596
625
|
|
|
597
626
|
**1. Requirements** — `minSdkVersion 24`, `compileSdkVersion 35+`.
|
|
598
627
|
|
|
599
|
-
**2. Dependencies brought by the native SDK** — `okhttp 4.12`, `retrofit 2.9`, `gson 2.10`, `installreferrer 2.2`, `play-services-ads-identifier 18.0.1`, `androidx.lifecycle:lifecycle-process`. Gradle resolves conflicts to the highest version; if you pin `okhttp` lower than 4.12 in your app, raise it.
|
|
628
|
+
**2. Dependencies brought by the native SDK** — `okhttp 4.12`, `retrofit 2.9`, `gson 2.10`, `installreferrer 2.2`, `play-services-ads-identifier 18.0.1`, `androidx.lifecycle:lifecycle-process`, `androidx.startup:startup-runtime`. Gradle resolves conflicts to the highest version; if you pin `okhttp` lower than 4.12 in your app, raise it.
|
|
600
629
|
|
|
601
630
|
**3. Permissions** — the SDK manifest declares `INTERNET`, `ACCESS_NETWORK_STATE` and `com.google.android.gms.permission.AD_ID`, plus two permissions and a set of `<queries>` entries used to read the OAID on devices without Google Play services. All of them merge into your app. Apps in the Families program, and any app directed to children under COPPA, must remove `AD_ID`:
|
|
602
631
|
|
|
@@ -604,13 +633,22 @@ The native SDK ships its own privacy manifest; the plugin adds no tracked APIs.
|
|
|
604
633
|
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />
|
|
605
634
|
```
|
|
606
635
|
|
|
607
|
-
Without that permission the advertising id is
|
|
636
|
+
Without that permission the advertising id is not read. The OAID permissions and queries can be removed the same way — see the [Android SDK README](https://github.com/AdShift/android-sdk#permissions).
|
|
608
637
|
|
|
609
638
|
**4. Backup rules** — the SDK manifest sets `android:fullBackupContent` and `android:dataExtractionRules` on `<application>` so its identifiers are never restored on a new install. The React Native template (`android:allowBackup="false"`, no rules attribute) merges cleanly. If your app declares its own rules attributes, the build fails with a manifest merger conflict: add `tools:replace` for the attributes you declare **and** copy the SDK's exclusions into your rules files — see the [Android SDK README, "Backup Rules"](https://github.com/AdShift/android-sdk#backup-rules).
|
|
610
639
|
|
|
611
640
|
**5. App Links** — add the intent filters for your branded domain / custom scheme to `MainActivity`; `launchMode="singleTask"` (the template default) is recommended. No JavaScript code is needed.
|
|
612
641
|
|
|
613
|
-
|
|
642
|
+
Keep each new Intent in `MainActivity`. React Native drops an Intent that arrives before JavaScript is ready, so without this a link tapped while Android is re-creating your app (after it killed the process in the background) is lost:
|
|
643
|
+
|
|
644
|
+
```kotlin
|
|
645
|
+
override fun onNewIntent(intent: Intent) {
|
|
646
|
+
super.onNewIntent(intent)
|
|
647
|
+
setIntent(intent)
|
|
648
|
+
}
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
**6. Code shrinking** — the native SDK ships consumer ProGuard rules, so `minifyEnabled true` needs no keep rules of your own, and release builds with shrinking enabled are part of our build checks. SDK frames in crash reports arrive obfuscated; upload your release `mapping.txt`. Do not add `-keep class com.adshift.sdk.** { *; }` — it is not needed and forces the whole native SDK into the APK unshrunk.
|
|
614
652
|
|
|
615
653
|
**7. Devices without Google Play services** — the SDK reads the OAID itself when `collectOaid` is on (the default). If your app already obtains it, pass it with `Adshift.setOaidData(oaid)` and set `collectOaid: false`.
|
|
616
654
|
|
|
@@ -643,9 +681,9 @@ Notes that decide several rows for you:
|
|
|
643
681
|
|
|
644
682
|
- **The advertising id is optional in practice.** On Android it is read only while the `AD_ID` permission is present (see [Platform Setup → Android](#android)); on iOS only after the user allows tracking through ATT. Removing the permission, or never showing the ATT prompt, keeps the identifier out of your declaration — attribution continues on the SDK's own install identifier, which is still collected.
|
|
645
683
|
- **Consent gates it too.** When you report a refusal through the consent API, the advertising id is withheld; `Adshift.refreshConsent()` returns `adIdentifiersAllowed` so you can see the current answer.
|
|
646
|
-
- **No location
|
|
684
|
+
- **No location permission or API is used.** The country reported by the SDK comes from the device's region setting. The iOS SDK's privacy manifest declares Coarse Location; check your App Privacy answers against the privacy report Xcode generates.
|
|
647
685
|
- **Custom event parameters are yours.** Whatever you pass to `trackEvent` is sent as you wrote it, so anything personal in there belongs in your declaration.
|
|
648
|
-
- **
|
|
686
|
+
- **Only a RightLink link is sent, and only its attribution parameters.** Any other key of its query stays on the device, in `params`. A URL that is not a RightLink link is not sent at all.
|
|
649
687
|
- **Everything travels over HTTPS.**
|
|
650
688
|
|
|
651
689
|
Whether your app's data counts as "shared" under Play's definition, and whether the identifiers are used for tracking under Apple's definition, depends on your agreement with AdShift rather than on the SDK — settle those two with us before you submit.
|
|
@@ -656,7 +694,7 @@ Whether your app's data counts as "shared" under Play's definition, and whether
|
|
|
656
694
|
|
|
657
695
|
The plugin contains native code, so it works with **development builds / prebuild** (`expo run:ios`, `expo run:android`, EAS Build) and not with Expo Go.
|
|
658
696
|
|
|
659
|
-
No config plugin is needed, and neither is any native edit:
|
|
697
|
+
No config plugin is needed, and neither is any native edit, with one exception: the `onNewIntent` override in step 5 of the [Android setup](#android) needs a config plugin of your own.
|
|
660
698
|
|
|
661
699
|
- Autolinking and codegen pick the module up.
|
|
662
700
|
- Expo forwards opened URLs and universal links to React Native's `Linking` itself, so skip step 2 of the [iOS setup](#ios) — the generated `AppDelegate.swift` is regenerated by `expo prebuild` anyway.
|
|
@@ -690,9 +728,38 @@ The package ships both ES module and CommonJS builds, so the default `react-nati
|
|
|
690
728
|
|
|
691
729
|
---
|
|
692
730
|
|
|
731
|
+
## Upgrading from 3.0
|
|
732
|
+
|
|
733
|
+
3.1.x targets Android SDK 4.2.0 and iOS SDK 3.1.0 (see [Native SDK versions](#native-sdk-versions)). Nothing in the API changes.
|
|
734
|
+
|
|
735
|
+
- **iOS: the SDK comes inside the plugin.** If your `Podfile` has `pod 'AdshiftSDK'`, remove the line; `pod install` stops on it. Do not add `AdshiftSDK` through Swift Package Manager either.
|
|
736
|
+
- **After `stop()` a link's click is not counted on either platform.** On Android 3.0 counted it at the next `start()`. The link still reaches `onDeepLink`.
|
|
737
|
+
- **iOS: a deferred result has `deep_link_sub1`…`deep_link_sub5` in `params`**, as on Android.
|
|
738
|
+
|
|
739
|
+
---
|
|
740
|
+
|
|
741
|
+
## Upgrading from 2.x
|
|
742
|
+
|
|
743
|
+
3.0 targeted Android SDK 4.1.0 and iOS SDK 3.0.0 and was a breaking release. Nothing in the API was removed or renamed; what changes is what `onDeepLink` delivers.
|
|
744
|
+
|
|
745
|
+
- **Route only on `status === 'found'`.** 2.x answered `found` for every URL. Now a URL that is not a RightLink link, your app's own scheme included, comes back `notFound`: route your own links from `deepLink` there.
|
|
746
|
+
- **Declare every branded link domain in `brandedDomains`**, or its links come back `notFound` and are not counted.
|
|
747
|
+
- **Treat `error` as "not yet".** The same link can still arrive as `found`.
|
|
748
|
+
- **On iOS a deferred result has no `deepLink`.** Route on `deepLinkValue` and `deepLinkSub1`…`deepLinkSub5`.
|
|
749
|
+
- **Register `onDeepLink` once, early.** Each result is delivered once.
|
|
750
|
+
- **With a CMP, call `start()` after `setConsentData()`**, so the link that opened the app is recorded under that consent.
|
|
751
|
+
- **iOS: review your App Privacy answers.** The SDK's privacy manifest now also declares Coarse Location and Other Diagnostic Data.
|
|
752
|
+
- **iOS: the SDK removes its 2.x keys from `UserDefaults`** — `click_id`, `click_time`, `deep_link_params` and `raw_link_url`, once, the first time 3.x runs. If your native code keeps its own data under these names, move it first.
|
|
753
|
+
- **Android: keep each new Intent in `MainActivity`** — the `onNewIntent` override in step 5 of the [Android setup](#android).
|
|
754
|
+
- **Android: declare AppCompat or Material yourself** if your app used either without declaring it; the native SDK no longer brings them. Huawei's `ads-installreferrer` is no longer needed.
|
|
755
|
+
|
|
756
|
+
New in 3.x: `AdshiftDeepLink.source`, `clickId` and `matchGuaranteed`, `AdshiftConfig.testMode`, and on iOS `deferredDeepLinkClipboard` with `Adshift.handlePastedDeepLink()`.
|
|
757
|
+
|
|
758
|
+
---
|
|
759
|
+
|
|
693
760
|
## Upgrading from 1.x
|
|
694
761
|
|
|
695
|
-
2.x
|
|
762
|
+
2.x targeted Android SDK 3.2.0 and iOS SDK 2.4.0 and was a breaking release.
|
|
696
763
|
|
|
697
764
|
**Removed**
|
|
698
765
|
- `NativeAdShiftReactNativePlugin` and `AdShiftNativeSpec` exports — the native module is internal.
|
|
@@ -705,7 +772,7 @@ The package ships both ES module and CommonJS builds, so the default `react-nati
|
|
|
705
772
|
- No method raises any more. Promises still reject; the rest report through `config.onError` and skip the call. Remove `try/catch` around `initialize()` and the setters, and read `onError` instead.
|
|
706
773
|
- Setters called before `initialize()` are kept and applied afterwards instead of failing.
|
|
707
774
|
- Deep links are forwarded automatically by default (`autoHandleDeepLinks`). Remove your `Linking.addEventListener('url', …) → handleDeepLink` code, or keep it — the plugin deduplicates its own forwards. On iOS add the `RCTLinkingManager` handlers to `AppDelegate.swift`.
|
|
708
|
-
- Consent flags are tri-state (`boolean | null`); `AdshiftConsent.forGDPRUser()` accepts partial input
|
|
775
|
+
- Consent flags are tri-state (`boolean | null`); `AdshiftConsent.forGDPRUser()` accepts partial input. `AdshiftConsent.isConsentGranted` requires explicit `true`.
|
|
709
776
|
- `refreshConsent()` resolves a typed `ConsentSnapshot`.
|
|
710
777
|
- `AdshiftDeepLink.params` is `Record<string, string>`; `isFirstSession` added (Android).
|
|
711
778
|
- `trackEvent`/`trackPurchase` calls before `start()` are queued (up to 100) instead of failing; after `stop()` they reject with `NOT_STARTED`.
|
|
@@ -736,9 +803,13 @@ Replace `API_KEYS` in `example/src/App.tsx` with keys from the AdShift dashboard
|
|
|
736
803
|
|
|
737
804
|
## Troubleshooting
|
|
738
805
|
|
|
806
|
+
**`pod install` stops with `The 'Pods-YourApp' target has frameworks with conflicting names: adshiftsdk.xcframework.`** — your `Podfile` adds the AdShift iOS SDK next to the copy inside the plugin. Remove `pod 'AdshiftSDK'` and run `pod install` again.
|
|
807
|
+
|
|
739
808
|
**Links do not arrive on iOS while the app is running** — add the `RCTLinkingManager` methods to `AppDelegate.swift` ([Platform Setup → iOS](#ios)).
|
|
740
809
|
|
|
741
|
-
**
|
|
810
|
+
**My own links stopped arriving as `found`** — only RightLink links are `found`. Route your own links on `notFound`, from `deepLink` ([Deep Linking](#deep-linking)).
|
|
811
|
+
|
|
812
|
+
**A link on my own domain comes back `notFound`** — add the domain to `brandedDomains` in `initialize()`.
|
|
742
813
|
|
|
743
814
|
**The first events on iOS arrive late** — `waitForATTBeforeStart: true` without an ATT prompt holds their delivery for `attTimeoutMs`. Set the option only when your app actually prompts.
|
|
744
815
|
|
|
@@ -752,20 +823,6 @@ Replace `API_KEYS` in `example/src/App.tsx` with keys from the AdShift dashboard
|
|
|
752
823
|
|
|
753
824
|
---
|
|
754
825
|
|
|
755
|
-
## For Maintainers
|
|
756
|
-
|
|
757
|
-
**Release**
|
|
758
|
-
1. Update `CHANGELOG.md` (including the native SDK matrix row) and the pins (`android/build.gradle`, `AdShiftReactNativePlugin.podspec`, `NATIVE_SDK_VERSIONS` in `src/Adshift.ts`).
|
|
759
|
-
2. `yarn version <new version>` regenerates `src/version.ts`; commit.
|
|
760
|
-
3. Push a tag: `v2.0.0-rc.1` publishes to the `next` dist-tag, `v2.0.0` to `latest`. The workflow fails if the tag does not match `package.json`.
|
|
761
|
-
4. Publishing uses npm **trusted publishing** (OIDC) from `.github/workflows/publish.yml`; no npm token is stored in the repository. The package's trusted publisher on npmjs.com must point at this repository and workflow file.
|
|
762
|
-
|
|
763
|
-
**Verification before GA** — an RC must run through the manual device test plan in a fresh RN 0.82+ app and at least one real application on `@adshift/react-native-plugin@next`.
|
|
764
|
-
|
|
765
|
-
**Rollback** — never `npm unpublish`. Deprecate the faulty version (`npm deprecate @adshift/react-native-plugin@x.y.z "…"`) and publish a fixed patch. A defect in a native SDK is fixed by a plugin patch release with a bumped pin.
|
|
766
|
-
|
|
767
|
-
---
|
|
768
|
-
|
|
769
826
|
## Support
|
|
770
827
|
|
|
771
828
|
- Documentation: https://dev.adshift.com/docs/react-native-plugin
|
package/android/build.gradle
CHANGED
|
@@ -83,8 +83,9 @@ dependencies {
|
|
|
83
83
|
implementation "com.facebook.react:react-android"
|
|
84
84
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
implementation "com.adshift:android-sdk:4.2.0"
|
|
87
|
+
// Already in the app through the SDK; declared for ActivityIntentsInitializer.
|
|
88
|
+
implementation "androidx.startup:startup-runtime:1.1.1"
|
|
88
89
|
|
|
89
90
|
testImplementation "junit:junit:4.13.2"
|
|
90
91
|
testImplementation "androidx.test:core:1.6.1"
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# Intentionally empty. Two reasons, and both are worth knowing before adding
|
|
4
|
-
# anything here.
|
|
5
|
-
#
|
|
6
|
-
# The native SDK ships its own consumer rules inside its AAR, and this plugin
|
|
7
|
-
# depends on it, so an app that depends on the plugin inherits them. Those rules
|
|
8
|
-
# cover the JSON layer the SDK reads by reflection: the Signature attribute, the
|
|
9
|
-
# type-token hierarchy the persisted queues rely on, and the SDK's wire models.
|
|
10
|
-
# A copy here would only duplicate them, and a copy that drifts is worse than no
|
|
11
|
-
# copy at all.
|
|
12
|
-
#
|
|
13
|
-
# This plugin has no JSON models of its own and does not depend on Gson. Its
|
|
14
|
-
# bridge classes are reached through React Native's module registry, which React
|
|
15
|
-
# Native's own consumer rules keep, and the custom Gson adapters in the native
|
|
16
|
-
# SDK are registered with constructed instances rather than by annotation, so
|
|
17
|
-
# nothing needs a no-argument constructor kept.
|
|
18
|
-
#
|
|
19
|
-
# A rule added here applies to the whole of the integrating app, not just to
|
|
20
|
-
# this plugin, so scope anything you do add. `-if class *` reaches the app's own
|
|
21
|
-
# models and every other library's.
|
|
1
|
+
# Intentionally empty: the SDK, React Native and androidx.startup ship the rules this plugin
|
|
2
|
+
# needs. A rule here applies to the whole app, so scope any you add.
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
3
|
+
|
|
4
|
+
<application>
|
|
5
|
+
<provider
|
|
6
|
+
android:name="androidx.startup.InitializationProvider"
|
|
7
|
+
android:authorities="${applicationId}.androidx-startup"
|
|
8
|
+
android:exported="false"
|
|
9
|
+
tools:node="merge">
|
|
10
|
+
<meta-data
|
|
11
|
+
android:name="com.adshift.reactnativeplugin.ActivityIntentsInitializer"
|
|
12
|
+
android:value="androidx.startup" />
|
|
13
|
+
</provider>
|
|
14
|
+
</application>
|
|
2
15
|
</manifest>
|