Skip to main content

Overview

MoEngage’s Self-handled experience gives you the flexibility of creating Personalize API Campaigns on the MoEngage Platform and displaying the experience anywhere on the website. It allows you to fetch the experience’s data using the SDK which you can use to personalize the user experience on the website. 

Implementing Self Handled Experiences

Pre-requisites

SDK installation

  1. Refer to this article to integrate the Web SDK on your website.
  2. Refer to this article to integrate the Personalize SDK on your website.

Creating Personalize API experience

Refer to this article to create a Personalize API experience. 

Fetching Personalize API experiences

Use the below SDK method to fetch the experiences and build your own UI using the result.
<script type="text/javascript">
Moengage.personalize.fetchExperiences([experienceKey1,experienceKey2,...,experiencekeyN],{json KV pair for custom attributes}).then((result) => {
  // additional processing using 'result' containing the Response payload
})
</script>
ParameterDescription
Moengage.personalize.fetchExperiences([<list of experience keys>], {custom attributes KV pair})fetchExperiences is the Web SDK method that will fetch all the Personalize API experiences as per the experience keys & custom attributes specified as input.
[<list of experience keys>]This is an optional input.
If no input is specified, then the method will return the response payload based on the following conditions:
1. Logged in User - If the user is logged in using the SDK, then response will contain the payload of all the experiences in which user is part of the target audience.
2. Anonymous user - If there is no user logged in using the SDK, then the response will contain the payload of all experiences that are targeted for All Users.
Example: ["home-page-banner", "cart-checkout-offers"]

In the above input, the method will return the payload for experiences configured with the keys “home-page-banner” and “cart-checkout-offers” respectively.
{custom attributes KV pair}This is an optional input. Custom Attributes are the additional values used to define a target audience while creating a Personalized API experience. Refer to this article for more details.
Example: {"locale": "en"}

When you pass the above input, the response will contain all the experiences with audiences defined using the custom attribute locale and value equals “en”
For further assistance, please contact your MoEngage Customer Success Manager (CSM) or the Support team.