Actions

Create Social Proof Actions

Social proof is a demonstration that other people have purchased or found value in a product or service. This demonstration helps the product or service stand out from others and makes the customer more likely to purchase it. These demonstrations often reflect existing customer behavior. For example, labelling a product as a bestseller is a social proof demonstration.

You can set up a handler for Omnichannel Social Proof actions using two methods. The addEvent method defines the events that can trigger the action. The getActionsData method is then used as the trigger and requests the decision based on the defined events. getActionsData then returns a JSON object containing social proof data that you can then handle in code.

Prerequisites

You must first create an Omnichannel Social Proof action in the Monetate platform for the methods to reference. Refer to Configure an Omnichannel Social Proof Action in the Monetate Knowledge Base for instructions.

Make note of the WHO settings because they correspond to events your code listens for. The example experience in this article uses the following WHO settings:

  • IP address is 1.0.0.2
  • Screen height is at least 500 pixels and screen width is at least 300 pixels

Also make note of the Social Proof type that you're creating.

The full code examples fulfill these conditions and will trigger the Social Proof action.

addEvent

This method adds event data to the SDK's internal stack.

React Native
React Web
iOS
Android
addEvent Method


The parameters are as follows:

  • context is name of the event.
  • events is the event data.

You can use this method multiple times to add all the necessary events for an experience you want to trigger. The example code uses multiple method calls to fulfill the experience requirements.

Code Example

React Native
React Web
iOS
Android
addEvent Example


getActionsData

This method sends the defined events to Monetate to trigger an experience. If the events fulfill the WHO settings and the other required conditions of an experience, that experience is triggered. A JSON object containing the experience response is then returned.

React Native
React Web
iOS
Android
getActionsData Method


The parameter is as follows:

  • actionType is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
  • includeReporting indicates whether the response will have impression reporting data.

Code Example

React Native
React Web
iOS
Android
getActionsData Example


The following code examples are for each type of Social Proof messaging.

Viewed Product Full Code Example

This Social Proof type displays the message on products as determined by the number of times customers viewed a specific product detail page.

React Native
React Web
iOS
Android
Viewed-Based Social Proof Action Example


Carted Product Full Code Example for Product Detail Pages

This Social Proof type displays the message on products most frequently added to a cart. To target product detail pages, you must add the ContextProductDetailView event.

React Native
React Web
iOS
Android
Carted-Based Social Proof Action Example—Product Detail Pages


Carted Product Full Code Example for Pages Displaying Multiple Product IDs

This code example is for displaying a Social Proof message on the products most frequently added to a cart on page types that contain multiple product IDs, such as product category listings, search results pages, and cart pages. To target multi-PID pages, you must add the ProductThumbnailView event.

React Native
React Web
iOS
Android
Carted-Based Social Proof Action Example—Multi-PID Pages


Purchased Product Full Code Example for Product Detail Pages

This Social Proof type displays a message on products most frequently purchased. To target product detail pages, you must add the ContextProductDetailView event.

React Native
React Web
iOS
Android
Purchased-Based Social Proof Action Example—Product Detail Pages


Purchased Product Full Code Example for Pages Displaying Multiple Product IDs

This Social Proof type displays a message on products most frequently purchased. To target page types that contain multiple product IDs—such as product category listings, search results pages, and cart pages—you must add the ProductThumbnailView event.

React Native
React Web
iOS
Android
Purchased-Based Social Proof Action Example—Multi-PID Pages


Recommended Product Full Code Example

This Social Proof type uses a recommendation strategy to determine and display a message on products the customer is most likely to purchase. You must add the ContextProductDetailView event.

React Native
React Web
iOS
Android
Recommendation Strategy-Based Social Proof Action Example


Inventory Full Code Example for Product Detail Pages

This Social Proof type displays a message on products based on your current inventory, which may indicate that a product is popular due to limited inventory count. To target product detail pages, you must add the ContextProductDetailView event.

React Native
React Web
iOS
Android
Inventory-Based Social Proof Action Example—Product Detail Pages


Inventory Full Code Example for Pages Displaying Multiple Product IDs

This Social Proof type displays a message on products based on your current inventory, which may indicate that a product is product due to limited inventory count. To target page types that contain multiple product IDs—such as product category listings, search results pages, and cart pages—you must add the ProductThumbnailView event.

React Native
React Web
iOS
Android
Inventory-Based Social Proof Action Example—Multi-PID Pages