Skip to main content

Define interventions to trigger real-time actions with Signals

Interventions are automated triggers that enable real-time actions based on user behavior. You'll need to define them, as described on this page, and subscribe to them in your application.

There are three methods for defining interventions in Signals:

Signals has two types of interventions: rule-based interventions, which trigger automatically when their criteria are met, and direct interventions, which you push manually using the SDK or API.

To create an intervention using the UI, go to Signals > Interventions in Snowplow Console and follow the instructions.

The first step is to specify:

  • A unique name
  • An optional description
  • The email address of the primary owner or maintainer

Create intervention form with name, description, and owner fields

Next, configure when the intervention should trigger.

Criteria

Criteria are the conditional rules that determine when an intervention should trigger.

Sent once

An intervention is sent only the first time the criteria are met. Read an example of how this works in the delivery example.

When a referenced attribute is updated, the updated and previous states are evaluated against the criteria. If the previous state did not meet the conditions but the newly updated state does, the trigger activates. Criteria always refer to the latest published version of the attribute group that contains the attribute.

Defining intervention criteria has three steps:

  1. Select which attribute from a published attribute group to evaluate
  2. Choose which logical operator to use
  3. Enter the value to trigger on

Intervention criteria configuration showing attribute selection, operator, and value fields

When adding more than one criterion, you can require all or any of them to be met.

Multiple intervention criteria with "all" or "any" logic selection

These attributes are both from groups with the domain_userid attribute key. Therefore, this intervention is targeted to users. When a subscribed user reaches 10 page views while using Chrome, the intervention will trigger.

Target and payload

Interventions are delivered to attribute keys. By default, the intervention will target the attribute keys of the attribute groups defined in the criteria. Specify attribute keys if you want different targets.

Key constraints

Interventions can be defined against any attribute key, as long as its values are non-enumerable. For example, the built-in Snowplow attribute keys domain_userid, domain_sessionid, and network_userid are suitable targets since their values are canonically formatted UUIDs, e.g. 8c9104e3-c300-4b20-82f2-93b7fa0b8feb.

Custom targeting can be useful when you have broad criteria but want a more narrow target. For example, if your criteria use a broad attribute like page_id, you might not want to send the intervention to everyone on that page. If you're also checking user-specific criteria, target domain_userid to reach only the specific user who meets all conditions.

Another use for custom targeting is when you want to target an attribute key that's available in the triggering event, but isn't part of your intervention logic. For example, to send an intervention to a domain_userid when they do a certain number of things in a single pageview_id. By targeting the user rather than the page, you can ensure that the intervention is received even if they've gone onto a new page by the time the triggering event is processed, or if the application is not subscribed to the pageview_id.

Define a custom intervention target scope by selecting attribute keys. These are the attribute keys that will receive the information.

You can also select one or more attribute groups to be sent with the intervention. When the intervention triggers, it will include the latest values for all attributes in the selected groups.

Intervention delivery configuration showing attribute key targeting and attribute group payload selection

Publish and manage the intervention

Interventions only become active once published to your Signals infrastructure. Signals will then start monitoring attribute value changes. To receive and act on triggered interventions, your application will need an active subscription.

Once you're happy with your intervention configuration, click Create intervention to save it. It will be saved as a draft, and not yet available to Signals.

Intervention details page in Snowplow Console showing a status of Draft, with Edit and Publish action buttons

Click the Edit button if you want to make changes to the intervention.

To send the intervention configuration to your Signals infrastructure, click the Publish button.

Published intervention page with sample subscription code

The intervention page also includes sample code to help you subscribe to it. Read more about this on the subscription page.

Versioning

Interventions are versioned. This allows you to iterate on the definitions without breaking downstream processes. All interventions start as v1.

Within criteria, the attributes are always evaluated based on the latest published version of the attribute group that contains the attribute. For example, if attribute_group v1, v2, and v3 all have the required attribute, v3 will be used. If you then publish attribute_group v4, which removes attribute, v3 will still be used.

If you make changes to the definition, the version will be automatically incremented.

Unpublish or delete

To unpublish or delete an intervention in Console, click the button on the details page.

Intervention management menu showing Edit, Unpublish, and Delete options

Unpublishing is version specific. You can republish it later if needed. Choose Delete to permanently delete all versions of the intervention.

With the Python SDK, use the unpublish() and delete() methods.

Test the intervention

Signals provides two ways to test an intervention in Snowplow Console: a preview you can run before publishing, and a live test you can trigger once the intervention is published.

Preview

While defining an intervention, you can preview how many users would have received it by running it against the current state of your warehouse data. Click Run preview to see how many attribute keys match the criteria you've defined.

Intervention preview showing test results with match count against scanned warehouse records

Send a test intervention

Once the intervention is published, you can send a test by specifying a particular attribute key identifier. Signals will dispatch an intervention to that identifier so you can verify your subscription is set up correctly and diagnose any connection errors before relying on it in production. Your application must already be subscribed to that attribute key ID to receive the test.

Intervention connection test showing attribute key input field to send a test intervention

Direct interventions

Direct interventions have no criteria, and are not tied to attribute values. They use InterventionInstance objects, and are pushed to Signals using push_intervention, rather than being published like other configuration objects.

Not available in Snowplow Console

Direct interventions are only available using the Signals Python SDK or Signals API. They use the API's api/v1/registry/interventions endpoints under the hood, which require a valid, authorized bearer token.

You can directly push these interventions to any attribute keys. If the intervention is valid, Signals will immediately deliver it to any subscribers for the targeted attribute key IDs.

python
from snowplow_signals import AttributeKeyIdentifiers, InterventionInstance, Signals

# The specific attribute key IDs to publish the intervention to
targets = AttributeKeyIdentifiers({
"domain_sessionid": ["8c9104e3-c300-4b20-82f2-93b7fa0b8feb"],
})

sp_signals.push_intervention(
targets,
InterventionInstance(
name="my_intervention",
version=1,
)
)