Key-Value Pairs in In-App Campaigns

Use Key-Value Pairs in In-App Message Actions

Key-value (KV) pairs are extra data elements you can link to specific actions within an In-App Messaging campaign. Each KV pair includes a key and a value. The key describes the data, and the value is the data itself. Using KV pairs, you can send more information to your app when a user interacts with a campaign. This helps you create more personalized, dynamic, and trackable user experiences.

Marketers and developers use KV pairs to enhance user interactions, enable dynamic content, and improve campaign tracking. Developers also use KV pairs to pass custom parameters to the app’s code for specific actions.

Before You Start

  • Understand the specific data (keys and values) your app expects for different actions.

Add Key-Value Pairs to an In-App Message Action

To add KV pairs, perform the following steps:

  1. In the Content section of your In-App Message campaign, select a widget from the Preview area.

    2024-12-13_10-58-15 (1).gif

  2. Scroll down to the Actions section. Click + Action.

    2024-12-13_11-01-57 (1).gif

  3. Select an action from the Custom list.
  4. Click + New KV pair to add a key-value pair to this action.

    2024-12-13_11-04-06 (1).gif

  5. Under Key value pairs, enter the key in the Enter name field and the value in the Data field.

Here’s how you can use key-value pairs for different action types:

When you use a navigation action, KV pairs send extra information or instructions to the destination screen or URL in your app.

Why use Key-Value Pairs for Navigation?

  • Personalization: Guide users to specific content based on their interests or behavior. For example, pass a productId to direct users to a particular product page. Or pass an email address to prefill a form on the next page with the user’s email.
  • Dynamic content: Allow your app to load and display content dynamically, which improves the user experience.
  • Tracking and analytics: Include parameters like source to track where the navigation came from. This is valuable for understanding campaign performance.

Examples:

  • Key: productId, Value: 12345
  • Key: source, Value: inAppCampaign
  • Key: email, Value: {{UserAttribute['u_em']}}

Key-Value Pairs in Track Event Actions

When tracking an event, KV pairs act as event attributes. They provide more details about the event.

Why use Key-Value Pairs for Tracking Events?

  • Enhanced analytics: Enrich event data for deeper insights into user behavior.
  • Audience segmentation: Use detailed event attributes to create precise user segments for future campaigns.
  • Trigger automated actions: Set up specific KV pairs to trigger automated marketing actions within MoEngage, such as sending follow-up messages.

Examples:

Event Name: ButtonClicked

  • Key: buttonType, Value: SubscribeButton
  • Key: campaignId, Value: promo_2024

Key-Value Pairs in Custom Actions

For custom actions, developers can use key-value pairs as custom parameters. These parameters are passed to the app's code to run specific functions.

Why use Key-Value Pairs for Custom Actions?

  • Flexibility: Developers can define flexible actions using KV pairs and update them without changing the app's code.
  • Personalized user experience: Pass different parameters to tailor the app's behavior for individual users or specific campaign goals.
  • Dynamic updates: Enable the app to respond to in-app messages with up-to-date information, which boosts engagement.

Examples:

Action Name: OpenFeature

  • Key: featureName, Value: AugmentedRealityViewer
  • Key: accessLevel, Value: premium

Troubleshooting

  • Incorrect data type: Ensure the value you enter matches the data type expected by your app for the corresponding key. Incorrect types can cause the action to fail or data to be misinterpreted.
  • Mismatched keys: Verify that the key names you use in MoEngage exactly match what your app's code expects. Typos or casing differences can prevent the app from recognizing the data.
  • App-side implementation: Key-value pairs require proper handling within your mobile app's code. If the action isn't working as expected, confirm your developers have correctly implemented the logic to receive and use these pairs.

Next Steps

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?