For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Signals

Custom signals supplement built-in sensor data, improving decision-making and optimization for your use case.

What are custom signals?

Custom signals allow you to provide additional context when capturing user interactions. ContextSDK processes more than 300 built-in signals, but you can enhance its predictions by including app-specific data — such as in-game progress, friend count, or prior interactions like ad views or feature usage. Any past event that may influence a user’s decision-making process is valuable to include.

Why add custom signals?

By adding custom signals, you can:

  • Provide additional context when making upsell or engagement decisions to improve the precision of ML models.

  • Optimize monetization and user experience based on real-time behavioral data.

Despite that, it's worth noting that adding custom signals is optional. Not all apps and businesses have environment- or user-specific signals that would make a significant difference when deciding whether to show an upsell offer or not.

How to add custom signals

You can define custom signals at two levels:

Global Signals

Global signals apply to all context evaluations and persist across different flows. Use them for app-wide metrics, such as total session count or the number of purchases made. Usage example:

ContextManager.setGlobalCustomSignal(id: "number_of_levels_completed", value: 21)
ContextSDK.globalCustomSignals["number_of_levels_completed"] = 21
ContextSDK.Companion.getGlobalCustomSignals().set("number_of_levels_completed",
21);
_contextSdkPlugin.setGlobalCustomSignals({
  'number_of_levels_completed': 21,
});
ContextSDKBinding.SetGlobalCustomSignal("number_of_levels_completed", 21);
setGlobalCustomSignals({ number_of_levels_completed: 21 })

To update a signal, call setGlobalCustomSignal(id:value:) with the same ID and a new value. To remove a global signal, pass a null-like value.

Flow-Specific Signals

Use flow-specific signals when a signal is relevant only to a particular flow. These signals are passed as parameters when capturing a context. Usage example:

Flow-specific signals ensure that only relevant data is included in decision-making for a particular flow.

Signal ID and value requirements

A signal ID must be non-empty and should contain only letters, numbers and underscores (for example number_of_levels_completed), and should be at most 128 characters long. Any other character is replaced with an underscore when a model refers to the signal, so cart-value and cart.value become the same signal name and collide with each other.

Numeric values must be finite. A NaN or infinite float or decimal value is discarded, and the signal is not recorded for that context.

The SDK logs a message to the console when you set a signal it cannot use, so watch the console output while integrating. Each problem is logged once per signal ID, not once per call.

Privacy Considerations

When using custom signals, ensure that no personally identifiable information (PII) is included. ContextSDK does not process sensitive data, such as:

  • User IDs

  • Email addresses or phone numbers

  • IP addresses

  • Exact locations

  • Date of birth or age

  • Gender

You are responsible for ensuring that you have the necessary rights to provide data to ContextSDK.

By leveraging custom signals, you can refine ContextSDK’s predictions and optimize monetization strategies — all while maintaining user privacy and security.

Last updated

Was this helpful?