Deeplinks automations

Purchasely supports the use of Deeplinks to trigger different actions to improve conversion, retention and upsell. You can send a Push or an email with that deeplink and Purchasely will open the requested presentation or page for you.

Here are the actions Purchasely supports:

  • Display a product page (paywall)

  • Display the user subscriptions

  • Display the cancellation survey

  • Update credit card (Deeplink to App Store)

Integration

To integrate these automations you need 2 things:

  • Pass the deeplink to Purchasley when it is received by the application

  • Allow Purchasely to display content over your interface

The first thing you need to do is to pass the deeplink URL to Purchasely when your app receives it:

Swift
Objective-C
Kotlin
Java
Swift
// ---------------------------------------------------
// If you are **NOT** using SceneDelegate
// ---------------------------------------------------
// AppDelegate.swift
import Purchasely
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
// You can chain calls to multiple handler using a OR
return Purchasely.handle(deeplink: url)
}
// ---------------------------------------------------
// If you are using SceneDelegate
// ---------------------------------------------------
// SceneDelegate.swift
import Purchasely
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// …
if let url = connectionOptions.urlContexts.first?.url {
_ = Purchasely.handle(deeplink: url)
}
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
_ = Purchasely.handle(deeplink: url)
}
}
Objective-C
// ---------------------------------------------------
// If you are **NOT** using SceneDelegate
// ---------------------------------------------------
// AppDelegate.m
#import <Purchasely/Purchasely-Swift.h>
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
// You can chain calls to multiple handler using a OR
return [Purchasely handleWithDeeplink:url];
}
// ---------------------------------------------------
// If you are using SceneDelegate
// ---------------------------------------------------
// SceneDelegate.m
#import <Purchasely/Purchasely-Swift.h>
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// …
NSURL *url = connectionOptions.URLContexts.allObjects.firstObject.URL;
if (url != nil) {
[Purchasely handleWithDeeplink:url];
}
}
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL *url = URLContexts.allObjects.firstObject.URL;
if (url != nil) {
[Purchasely handleWithDeeplink:url];
}
}
Kotlin
class MyActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//retrieve intent data to get deeplink that opened your activity
val data = intent.data
if(data != null) {
//Purchasely sdk will return true if it handles the deeplink
val isHandledByPurchasely = Purchasely.handle(data)
}
}
}
Java
public class MyActivity extends FragmentActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//retrieve intent data to get deeplink that opened your activity
Uri data = getIntent().getData();
if(data != null) {
//Purchasely sdk will return true if it handles the deeplink
boolean isHandledByPurchasely = Purchasely.handle(data);
}
}
}

Allow display

Your app might have a launch routine that requires to be fulfilled before another screen can be displayed. It can be splash screen, on boarding, login …

The display of Purchasely deeplinks is deferred until you authorize it. Once your app is ready, notify Purchasely.

Swift
Objective-C
Kotlin
Java
React Native
Swift
Purchasely.isReadyToPurchase(true)
Objective-C
[Purchasely isReadyToPurchase: YES];
Kotlin
Purchasely.isReadyToPurchase = true
Java
Purchasely.setReadyToPurchase(true);
React Native
Purchasely.isReadyToPurchase(true);

Product

You can open a product presentation directly to the user with the default presentation or a specific one used for a specific purpose / promotion.

⚠️ This kind of push requires users opt-in (see App Store Review Guidelines - 4.5.4).

app_scheme://ply/presentations/PRESENTATION_VENDOR_ID

app_scheme://ply/presentations

Cancellation survey

Cancellation survey can be triggered to get some feedback by the user after a subscription cancellation.

app_scheme://ply/cancellation_survey

app_scheme://ply/cancellation_survey/PRODUCT_VENDOR_ID

Subscriptions

This deeplink will open the subscriptions view inside the app.

app_scheme://ply/subscriptions

Update billing

This deeplink will open the App Store / Play Store setttings for the user to updates its credit card after a payment error.

app_scheme://ply/update_billing