Widget Events

Widget Events is a feature designed to facilitate communication between the widget
and the host app. By leveraging this feature, host apps can subscribe to events.
This feature allows you to provide a more interactive experience to your users.

Supported Host Platforms

Integrations

Widget Events API

Depending on the platform, the widget events can be delivered as a JSON string
(Android, iOS, React Native, Flutter) or as a JavaScript object (Web).

Event Types

Event TypeDescriptionPayload
readyThe widget is loaded and ready to be used.Ready Event Payload
redirectSome component emitted a redirect event.Redirect Event Payload

Event Structure

FieldTypeDescription
typestringThe event type.
sourcestringAlways Scrimmage. Use it to filter out events from other sources.
payloadobjectThe event data.

Ready Event

No additional data.

Example:

{
  "type": "ready",
  "source": "Scrimmage",
  "payload": {}
}

Redirect Event

FieldTypeDescription
redirectstringThe data that was emitted by the component that triggered the event. Can be a URL or any other data.
parametersobjectInformation about the component that triggered the event.

Example:

{
  "type": "redirect",
  "source": "Scrimmage",
  "payload": {
    "redirect": "/some-url",
    "parameters": {
      "target": "quest",
      "quest": {
        "id": "quest-id"
      }
    }
  }
}

Testing

You can test the widget events by using the Scrimmage Rewards Admin Dashboard.

  1. Open the Admin Dashboard.
  2. Navigate to the Widget Preview page.
  3. Enter the user ID for which you want to test the widget events.
  1. Click the Preview button.
  2. Click around. When you click on a component that emits an event, the event
    will be displayed in the Widget Events section.