Skip to main content
Gainsight Inc.

Engagement Call Back

Overview

Gainsight PX provides the Engagement Callback feature for mobile engagements that you create for mobile applications. This feature helps in receiving a callback for all button actions and URL clicks that the end-user performs on an engagement. Once you receive the callback, you can decide your next action like helping the user to navigate to a new screen, or perform an API call, and so on.

Prerequisite

Ensure that you have installed/configured the Gainsight PX Mobile SDK v1.5.1 or above

Configure Engagement Callback for Android

To use the Engagement Callback feature for Android devices, you need to implement the EngagementCallback interface.

Example:

public class GlobalEngagementCallback implements GainsightPX.EngagementCallback {

private static GainsightPX.EngagementCallback instance;
private final Context context;

private GlobalEngagementCallback(Context context) {
  this.context = context;
}

public static GainsightPX.EngagementCallback instance(Context context) {
  if (null == instance) {
    synchronized (GlobalEngagementCallback.class) {
      if (null == instance) {
        instance = new GlobalEngagementCallback(context.getApplicationContext());
      }
    }
  }
  return instance;
}

@Override
public boolean onCallback(EngagementMetaData engagementMetaData) {
  // Here you can do your functionality based on the callback.
  return true;
}
}

 While you initialize the SDK with the below function:

GainsightPX.Builder builder = new GainsightPX.Builder(Context context, String YOUR_PRODUCT_ID);

You can add the EngagementCallback functionality as follows: 

builder.engagementCallback(GlobalEngagementCallback.instance(this))

For more information on initializing SDK, refer to the Install Gainsight PX SDK for Android article. 

Configure Engagement Callback for iOS

To use the Engagement Callback feature for iOS applications, you need to implement the EngagementCallback interface.
iOS PXEngagementCallBack has two variables: EngagementCallBackModel and Error

Add the EngagementCallback functionality as follows:

public typealias PXEngagementCallBack = (EngagementCallBackModel?, Error?) -> Bool
 
GainsightPX.shared.initialise(configurations: configurations,
                                          completionBlock: nil) { callback, error in
   ...    return true
}

General Properties 

Property Type Description
actionText String The text of the linked element
actionType/
actionsType(iOS Native)
string Refers to the element that invoked the Engagement Callback.
Possible values: link, button.
engagementName string Name of the engagement for which the callback is received
scope object Mobile screen scope where the engagement is shown.
Possible values: screenName, screenClass.
engagementId string ID of the engagement for which the callback is received .

* actionData - reserved property for future usage; currently functions similar to actionText

* params - reserved property for future usage to send any custom parameters.

  • Was this article helpful?