Skip to content

Kenny/Update docs for notification conversion logging #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions docs/campaigns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The SDK will only sync up to the frequency cap number of notifications. As such,

With Radar [Conversions](/api#log-a-conversion), you can log an event whenever a user interacts with a campaign notification.

Refer to the [iOS SDK Conversions reference](/sdk/ios#conversions) for setup instructions.
Refer to the [iOS SDK Conversions reference](/sdk/ios#conversions) or [React Native Conversion references](/sdk/react-native#conversions) for setup instructions.

With Radar [Conversions](/api#log-a-conversion), you can also retrieve the source of an *opened_app* conversion for iOS apps. Within the *metadata* object of the [logged conversion](/sdk/ios#conversions), we will return a *conversion_source* with either
- **`notification`** (app was opened using an external 3rd party notification)
Expand Down Expand Up @@ -108,7 +108,7 @@ func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive respo
}
```

### Automated React Native setup (iOS only)
### React Native setup (iOS only)

Radar's React Native SDK can automatically set up deep linking for you. To enable this feature, set the `autoHandleNotificationDeepLinks` option to `true` in the `radarInitializeOptions` via the `AppDelegate.mm`.
```Objective-C
Expand All @@ -124,6 +124,16 @@ Radar's React Native SDK can automatically set up deep linking for you. To enabl
return res;
}
```

Alternatively perform the manual setup if you are setting the `AppDelegate` as the `UNUserNotificationCenterDelegate`.

```objc
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
[Radar openURLFromNotification:notification:response.notification];
completionHandler();
}
```

### Handle system deep link

Opening the notification will result in the SDK calling `[application openURL:url options:@{} completionHandler:nil];` This will open the URL in the app if it is registered for the scheme, or open the URL in the browser if it is not.
Expand Down
6 changes: 5 additions & 1 deletion docs/sdk/ios.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
</TabItem>
</Tabs>

Alternatively, perform the manual setup:
<Alert alertType="warning">
When using the automatic setup `Radar.initialize()` must be called after the `UNUserNotificationCenterDelegate` has been set. Be aware of third party SDK setup that may also set `UNUserNotificationCenterDelegate` and override the setup.
</Alert>

Alternatively, implement the `UNUserNotificationCenterDelegate` and perform the following manual setup:


<Tabs
Expand Down
15 changes: 14 additions & 1 deletion docs/sdk/react-native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ Radar.logConversion(
});
```

To enable logging of app opens through notifications taps on iOS, perform the following native setup in the app's AppDelegate:
To enable logging of app opens through notifications taps on iOS, perform the following automatic native setup in the app's AppDelegate:

```objc
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Expand All @@ -711,6 +711,19 @@ To enable logging of app opens through notifications taps on iOS, perform the fo
}
```

<Alert alertType="warning">
`[Radar nativeSetup:options];` must be called after the `UNUserNotificationCenterDelegate` has been set. Be aware of third party SDK setup that may also set `UNUserNotificationCenterDelegate` and override the automatic setup.
</Alert>

If you are setting the `AppDelegate` to be the `UNUserNotificationCenterDelegate`, you should perform the following manual setup:

```objc
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
[Radar logConversionWithNotificationResponse:response];
completionHandler();
}
```

### Notification options

On Android, you can call `setNotificationOptions` to set the icon and the background color of the foreground service and event notifications:
Expand Down