Customer Engagement

Learn to integrate CEE Cordova SDK for customer engagement

The Customer Engagement functionality in the Cordova SDK helps app developers connect better with their users. It enables easy integration of push notifications and in-app messages, allowing developers to send targeted, and personalized communication. You can optimize user engagement, increase conversions, and build user loyalty. Customise messages based on user behavior to deliver timely and relevant content.

For detailed instructions on each step, refer to the following:

  1. Install Smartech Push Cordova
  2. Integrate Android SDK/iOS SDK
  3. Initialize the Smartech Push Cordova SDK
  4. Retrieve Deeplink Data
  5. Add Listener for Notification Received

Install Smartech Push Cordova

Install CEE Cordova Smartech Push plugin by running below command from your project directory.

cordova plugin add smartech-push-cordova --save

For Android SDK

Refer to Android Customer Engagement steps to integrate the push notifications and In-App messages for Android platform.

  1. Define Latest SDK version: Add the version line to your gradle.properties.
// Version of smartech push SDK to use with Cordova
SMARTECH_PUSH_SDK_VERSION=<<push_sdk_android_version>>
  1. Integrate the latest CEE SDK: Make the following changes in the app-level build.gradle.
api "com.netcore.android:smartech-push:${SMARTECH_PUSH_SDK_VERSION}"

For iOS SDK

Refer to iOS Customer Engagement steps for integrate the Push notifications and In-app messages for iOS platform.

Import the Smartech SDK to make the following changes in the app-level.

#import <Smartech/Smartech.h>
#import <SmartPush/SmartPush.h>
#import <UserNotifications/UserNotifications.h>
#import <UserNotificationsUI/UserNotificationsUI.h>
#import Smartech
#import SmartPush
#import UserNotifications
#import UserNotificationsUI

Implement Smartech Delegate Method

#pragma mark - Smartech Delegate

- (void)handleDeeplinkActionWithURLString:(NSString *)deeplinkURLString andNotificationPayload:(NSDictionary *_Nullable)notificationPayload {
     NSString *notificationIdentifier = @"SmartechDeeplinkNotification";
  
    // Post a notification with the specified name and userInfo
    [[NSNotificationCenter defaultCenter] postNotificationName:notificationIdentifier object:nil userInfo:notificationPayload];
}
// MARK: - Smartech Delegate Methods

func handleDeeplinkAction(withURLString deeplinkURLString: String, andNotificationPayload notificationPayload: [AnyHashable : Any]?) {
    
    let notificationIdentifier = "SmartechDeeplinkNotification"
    NotificationCenter.default.post(name: Notification.Name(rawValue: notificationIdentifier), object: nil, userInfo: notificationPayload)
}

Initialize the SDK

You need to initialize the Smartech Push Cordova SDK to the CEE React Native library in your JavaScript file.

const SmartechPushCordova = window.pugins.SmartechPushCordova;

Retrieve Deeplink Data

You can provide the deep link value and the custom payload when a push notification is clicked.

const smartechBaseCordova = window.plugins.smartechBaseCordova;
const handleDeeplinkWithPayload = (smartechData) => {
     console.log('Smartech Data :: ', smartechData);
     console.log('Smartech Deeplink :: ', smartechData.smtDeeplink);
     console.log('Smartech CustomPayload:: ', smartechData.smtCustomPayload);
};

// Deeplink callback for Push Notification, In-App message and App Inbox
smartechBaseCordova.addListener(smartechBaseCordova.SmartechDeeplink, handleDeeplinkWithPayload);

//Remove this listener on cleanup
smartechBaseCordova.removeListener(smartechBaseCordova.SmartechDeeplink);

Add Listener for Notification Received

You can provide the push notification payload which is received from CEE.

const smartechPushCordova = window.plugins.SmartechPushCordova;

const handleNotificationReceived = (smartechData) => {
  console.log('Smartech Data :: ', JSON.stringify(smartechData));
};

// Adding the Smartech Deeplink Notification received Listener
smartechPushCordova.addListener(smartechPushCordova.SmartechNotificationReceived, handleNotificationReceived);

//Remove this listener on cleanup
smartechPushCordova.removeListener(smartechPushCordova.SmartechNotificationReceived, handleNotificationReceived);