Skip to content

Instantly share code, notes, and snippets.

@Bucimis
Created June 3, 2021 21:23
Show Gist options
  • Save Bucimis/364d35482b9b222557d25a8ccd57d91c to your computer and use it in GitHub Desktop.
Save Bucimis/364d35482b9b222557d25a8ccd57d91c to your computer and use it in GitHub Desktop.

Trigger Setup

To process triggers in your app, you can add an observer on BrazeTask.BrazeTriggers:

m.BrazeTask.observeField("BrazeTriggers", "onTrigger")

Then within your handler, you have access to the active triggers:

active_triggers = m.BrazeTask.BrazeTriggers

You can then decide what to do with the triggers. Some of the fields available on the trigger:

  • active_triggers[0].message - The body of the IAM
  • active_triggers[0].buttons - List of buttons (for full screen or modal campaigns)
  • active_triggers[0].trigger_id - ID to use when logging impressions or clicks You can log an impression:
m.Braze.logIAMImpression(active_triggers[0].trigger_id)

or a click:

m.Braze.logIAMClick(active_triggers[0].trigger_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment