Documentation Index
Fetch the complete documentation index at: https://moengage-getz-tagging-workspace-status.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The MoEngage Personalize SDK provides a secure framework for delivering personalized campaigns. It simplifies integration by handling user identity and authentication internally, eliminating the need to manage API secrets or manual HTTPS calls.How It All Fits Together
Before writing any code, it is helpful to understand the three moving parts of the personalization workflow:- Dashboard Configuration: A marketer creates an Experience Campaign in the MoEngage dashboard and assigns it a unique
experienceKey(e.g.,home_banner). They configure the specific JSON payload to be returned for different user segments. - The Meta Call : Your application calls
fetchExperiencesMetato discover which experience keys are active and available for the current user. - The Fetch Call : Your application calls
fetchExperienceorfetchExperienceswith a specific key to retrieve the actual payload. The SDK uses the metadata gathered in Step 2 to accurately resolve and return this request.
The SDK returns raw JSON only. As the developer, you are responsible for parsing this payload and building the corresponding UI in your application.
Integrate MoEngage Personalization
To add MoEngage’s Personalize SDK to your project, use the command below.Shell
Implementation Workflow
The Personalize helper for React Native is designed to simplify the retrieval and interaction with dynamic, personalized content. Below is a breakdown of the workflow and code placeholders.1. Fetch Meta Experience
Before fetching any specific payload or experience, you must invoke the metadata call. Prefetching the metadata helps you optimize the experience fetch. On the app side, you can use the metadata to identify the right personalized content for the current UI state and fetch only the relevant content instead of all the content in the application.ExperienceCampaignsMetadata object, containing all necessary metadata for campaign execution. The rejection contains the FailureReason and an optional message to identify the specific reason for the request’s failure.
2. Fetch Personalized Content
Once metadata is fetched, you can retrieve the actual personalized payloads. You can fetch a single experience or multiple experiences simultaneously, with full support for contextual targeting. EXPERIENCE_KEY is the unique key that is used in the experience campaign while creating the campaign on the MoEngage dashboard. You can find this key in the
ExperienceCampaignMeta object of the ExperienceCampaignsMetadata returned on successful metadata fetch.Fetch Single Experience
- Single Experience: Retrieve a single experience using a single experience key.
Fetch Multiple Experiences
- Bulk Experiences: Retrieve multiple experiences by passing an array of experience keys.
ExperienceCampaignsResult object containing all necessary metadata for campaign execution. The rejection contains the FailureReason and an optional message to identify the specific reason for the request’s failure.
Use Cases:
Contextual Targeting: Pass an object of attributes (e.g., {"current_page": "home", "cart_value": "500"}) during the fetch. This enables real-time, state-dependent content delivery (e.g., showing a “Free Shipping” banner if the cart value meets a threshold).
3. Notify SDK on Showing the Experience (Track Impressions)
An impression is a telemetry event that notifies the MoEngage SDK that a personalized campaign payload has successfully rendered on the UI and is visible to the user. To accurately track campaign performance, you must invoke the following methods the moment your application displays the personalized content on the screen.3a. Notify SDK for Experience Campaigns
Call theexperiencesShown() method when the UI element containing the experience renders.
3b. Notify SDK for Offering Campaigns
Offerings are a distinct subtype of personalized content configured by marketers on the MoEngage dashboard (such as dynamic product recommendations, catalogs, or unique coupon codes). Before tracking, it is important to understand how to handle offering payloads within your application:- Fetching an Offering: You retrieve an offering payload by calling the
fetchExperience()orfetchExperiences()methods. The SDK processes the metadata and returns the payload within theExperienceCampaignsResultobject. - Identifying an Offering: You can identify an offering by inspecting the structure of the returned JSON. An offering payload consists of structured data nested under a specific custom offering key.
- Building the Offering UI: The SDK only returns this offering data as raw JSON. As the developer, you must write the logic to parse this JSON payload and build the corresponding visual UI components on the screen.
4. Track Clicks
4a. Track Clicks for Experience Campaigns
Offerings are a distinct subtype of personalized content configured by marketers on the MoEngage dashboard (such as dynamic product recommendations, catalogs, or unique coupon codes). Before tracking, it is important to understand how to handle offering payloads within your application:- Fetching an Offering: You retrieve an offering payload by calling the
fetchExperience()orfetchExperiences()methods. The SDK processes the metadata and returns the payload within theExperienceCampaignsResultobject. - Identifying an Offering: You can identify an offering by inspecting the structure of the returned JSON. An offering payload consists of structured data nested under a specific custom offering key.
- Building the Offering UI: The SDK only returns this offering data as raw JSON. As the developer, you must write the logic to parse this JSON payload and build the corresponding visual UI components on the screen.
4b. Track Clicks for Offering Campaigns
For interactions with specific items (such as a product recommendation or a coupon) contained within an offering campaign:Example
Sample Payload
You can use these Offering-specific functions only if the campaign contains an offering payload (e.g., structured JSON data containing dynamic product recommendations, catalogs, or unique coupon codes nested under a specific offering key). For all other experience data, use the standard experience shown/clicked functions.
FAQs
How many experiences I can fetch?
How many experiences I can fetch?
You can fetch up to 25 experiences in a single call. If you exceed this, the SDK returns the 25 most recently updated experiences and notifies you of the unfulfilled keys.
What happens if a fetch request is made while the device is offline and no valid cache is available?
What happens if a fetch request is made while the device is offline and no valid cache is available?
The SDK returns an empty payload along with a standardized error code (e.g., NETWORK_ERROR).