LogoLogo
SDK ReferenceChangelogBlogStatusGet HelpGo To Dashboard
  • Introduction
  • Basics
    • How ContextDecision Works
    • How ContextPush Works
    • Getting Started
  • Context Decision
    • Logging Conversions
    • Revenue Outcomes
      • Logging Revenue with RevenueCat
    • Adding Entry Points
    • Release Checklist
    • Advanced
      • Custom Signals
      • Alternative Outcomes
      • Custom Outcome Metadata
      • Listening for Good Moments
      • Model Distribution Methods
      • Custom A/B Test Segmentation
      • Analytics & Reporting
  • Context Push
    • Integrating ContextPush
    • Push Notification Providers
      • OneSignal
      • Customer.io
      • Simple Web Request
    • Release Checklist
    • Analytics & Reporting
  • Discover By Use Cases
    • Multivariate Monetization
    • Inline Banners
  • Other Information
    • Glossary
    • Updating Your SDK
    • Minimum SDK Requirements
    • FAQ
    • Get Help
    • Changelog
  • Advanced
    • Custom Configuration
    • Capturing Context In Key Moments
Powered by GitBook
On this page
  • What is outcome metadata?
  • How do outcome metadata differ from custom signals and revenue outcomes?
  • Why log outcome metadata?
  • How to log outcome metadata

Was this helpful?

  1. Context Decision
  2. Advanced

Custom Outcome Metadata

Learn how to log custom outcome metadata to analyze user behavior and optimize monetization performance.

What is outcome metadata?

Outcome Metadata lets you attach additional details to a logged outcome, providing context about user behavior after an upsell offer is shown. For example, you can track whether a user clicked to learn more before making a purchase or interacted with other UI elements. ContextSDK records this information alongside the outcome, offering deeper insights into user behavior and monetization performance.

How do outcome metadata differ from custom signals and revenue outcomes?

Custom Signals provide additional context to the machine learning model at the time of context capture, allowing them to influence decision-making. In contrast, outcome metadata is recorded after a context has been captured and does not affect the decision-making process.

Revenue Outcomes are a specialized type of metadata that have dedicated APIs due to their importance. Use revenue outcomes to log details about in-app purchases, which will automatically include the product purchased, revenue, recurrence model, and other relevant metadata, without any extra effort.

Why log outcome metadata?

Outcome metadata helps provide a deeper understanding of user behavior. It can also indicate whether your app overrode the ML model’s decision — for example, due to an upsell offer cooldown mechanism. By capturing this data, you can improve reporting accuracy and ensure the necessary data is available to refine and enhance future models.

While metadata enriches outcome tracking, it does not influence when an upsell offer is shown. If you need to factor in additional signals for determining whether to display an offer, consider using Custom Signals instead.

How to log outcome metadata

Use appendOutcomeMetadata(_:) to attach metadata to a context before logging an outcome. The metadata will only be recorded if an outcome is logged.

context.appendOutcomeMetadata([
    CustomSignalString(id: "path", value: "flow_2"),
    CustomSignalBool(id: "clicked_learn_more", value: true),
])

After appending metadata, ensure that an outcome (whether positive or negative) is logged, e.g.:

context.logRevenueOutcome(from: product)
context.outcomeMetadata["path"] = "flow_2"
context.outcomeMetadata["clicked_learn_more"] = true

After appending metadata, ensure that an outcome (whether positive or negative) is logged, e.g.:

context.log(EventOutcome.POSITIVE)
context.getOutcomeMetadata().set("path", "flow_2");
context.getOutcomeMetadata().set("clicked_learn_more", true);

After appending metadata, ensure that an outcome (whether positive or negative) is logged, e.g.:

context.log(EventOutcome.POSITIVE);
context.appendOutcomeMetadata({
  'path': 'flow_2',
  'clicked_learn_more': true,
});

After appending metadata, ensure that an outcome (whether positive or negative) is logged, e.g.:

await context.log(Outcome.positive);
context.AppendOutcomeMetadata("path", "flow_2");
context.AppendOutcomeMetadata("clicked_learn_more", true);

After appending metadata, ensure that an outcome (whether positive or negative) is logged, e.g.:

context.Log(Outcome.Positive);
await context.appendOutcomeMetadata({
    path: 'flow_2',
    clicked_learn_more: true,
});

After appending metadata, ensure that an outcome (whether positive or negative) is logged, e.g.:

await context.log(Outcome.positive);

Appending metadata with the same ID multiple times replaces the previous value. This ensures only the most recent data is retained. To remove a value, pass nil.

PreviousAlternative OutcomesNextListening for Good Moments

Last updated 1 month ago

Was this helpful?