Tracking Conversion¶
The Conversion feature on Catalyst allows you to monitor the overall conversion rate of your Campaigns. In order for this feature to be activated an extra integration step is required to post the Conversion data to Catalyst.
The integration process is made up from two steps:
- Obtain a conversion token from the SDK.
- Post that token to the backend API after the conversion has occurred.
Obtain a conversion token from the SDK¶
You can use getConversionToken
method to get the conversion token which can be used to record the tracking of the conversion against your campaign. You can call this method anytime to get the conversion token for the last campaign served.
Note
Please note that the getConversionToken
returns only the token for the last served campaign. We suggest to save your token for the recently served campaigns when the user clicks on the notification.
From iOS 10 and above, you can call getConversionToken
method in the delegate of UNNotificationCenter.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
//app was in background and user clicked on local alert notification to bring app in foreground
[[PulseSDK sharedClient] loadViewOnUNNotificationClick:response.notification startInForeground:YES background:YES];
//get the conversion token from SDK and save it to record conversion in future
NSString *converionToken = [[PulseSDK sharedClient] getConversionToken];
}
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{
//app was in foreground
[[PulseSDK sharedClient] loadViewOnUNNotificationClick:notification startInForeground:YES background:YES];
//get the conversion token from SDK and save it to record conversion in future
NSString *converionToken = [[PulseSDK sharedClient] getConversionToken];
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
PulseSDK.sharedClient().loadView(onUNNotificationClick: response.notification, startInForeground: true, background: true)
//get the conversion token from SDK and save it to record conversion in future
let conversionToken = PulseSDK.sharedClient().getConversionToken()
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
PulseSDK.sharedClient().loadView(onUNNotificationClick: notification, startInForeground: true, background: true)
//get the conversion token from SDK and save it to record conversion in future
let conversionToken = PulseSDK.sharedClient().getConversionToken()
}
For devices below iOS 10, you can call getConversionToken
method in the delegate of UINotification
.
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
//app was in background and user clicked on local alert notification to bring app in foreground
[[PulseSDK sharedClient] loadViewOnNotificationClick:notification startInForeground:YES background:YES];
//get the conversion token from SDK and save it to record conversion in future
NSString *converionToken = [[PulseSDK sharedClient] getConversionToken];
}
func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
PulseSDK.sharedClient().loadView(onNotificationClick: notification, startInForeground: true, background: true)
//get the conversion token from SDK and save it to record conversion in future
let conversionToken = PulseSDK.sharedClient().getConversionToken()
}
Post Conversion Token¶
When the conversion occurs you need to submit an HTTP POST
request to the Catalyst Api https://{client_subdomain}.pulseid.com/log/event/convert/{conversion_token}
to record your campaign conversion.
Info
Please allow up to 5 minutes for the conversion data to get refreshed on the analytics screen.