4. Outcome Events API
Label and dispatch critical business or gameplay results to explicit target states, optimization goals, and conversion metrics.
API Cheat Sheet
Choose the right API tool depending on whether your data is persistent context, a generic timeline mark, or a business metric.
| API Surface | Data Nature | Ideal Game Dev Use Cases |
|---|---|---|
Attributes API Tracks the ongoing, rapidly changing runtime context of active gameplay. | Persistent State |
|
Events API Captures discrete, instantaneous milestones and actions down to the millisecond. | Point-in-Time |
|
Outcome Events API Labels explicit target states or conversion goals as a success or a failure. | Binary Outcome |
|
What are Outcome Events?
While standard Events capture raw, generic point-in-time telemetry, Outcome Events are specialized data points explicitly categorized by success or failure.
By wrapping events in a binary outcome state, you train the telemetry model to recognize patterns leading up to actions you want to encourage (e.g., buying a skin, completing a hard level) or discourage (e.g., leaving a match early, failing a tutorial).
The Outcome Enum
Every outcome event requires an explicit assignment from the Outcome type definition:
Outcome.Converted: Represents a desired goal, success metric, or positive conversion milestone.Outcome.UnConverted: Represents a missed opportunity, drop-off point, or unfavorable result.
The API Surface
The SDK provides a specialized method to pass explicit conversion results along with optional contextual metadata dictionaries.
1. Sending Outcome Events
Call SendOutcomeEvent to label a conversion goal immediately as it resolves. Like generic events, timestamps are calculated automatically at the exact moment of execution.
using NX10;
using System.Collections.Generic;
using UnityEngine;
public class StoreController : MonoBehaviour
{
public void HandlePurchaseResult(bool wasSuccessful, string packId, float price)
{
// Instantiating custom event context
var eventData = new Dictionary<string, object>
{
{ "pack_id", packId },
{ "price_usd", price }
};
if (wasSuccessful)
{
// Dispatches a positive conversion outcome event
NX10Manager.Instance.SendOutcomeEvent("iap_funnel", Outcome.Converted, eventData);
}
else
{
// Dispatches an unsuccessful outcome event
NX10Manager.Instance.SendOutcomeEvent("iap_funnel", Outcome.UnConverted, eventData);
}
}
}Data Constraints
Supported Metadata Types
- Strings (e.g., "premium_battlepass")
- Integers & Longs (e.g., 100, -5)
- Floats & Doubles (e.g., 9.99)
- Booleans (true, false)
- Null
Unsupported Types
Outcome Event metadata payloads must adhere to a strict flat structure.
- No nested objects, dictionaries, or JSON structures
- No internal Lists or Arrays
- No Unity custom types (e.g., Vector2, Color)
