Track In-Game Clicks on your Website

Use a postMessage to track in-game clicks directly from your website

You can configure clickable layers in your game to send a custom postMessage back to your website. This allows you to track specific user interactions, like a prize claim, directly in your own analytics or to trigger other events on your site.

While a postMessage can be applied to any clickable layer in the game, the following use case describes how to send a message when a user clicks on a prize.

📘

Impact on Prize Redirects

When claiming a prize, your users will be redirected to the popup_redirect_url you configured in the Prizes tab. The only difference is that a custom message is also sent to your parent website.

To configure the postMessage for a prize claim, do the following:

  1. Open the Editor in your game campaign.
  2. Select the button your user must click to claim the prize:
    1. In the Layout drop-down, select the screen that contains the prize claim option.
    2. Select the button the user must click to claim the prize.
      The image below shows how to select a prize claim button in a Popup Win screen:
Selecting an example prize claim button

Selecting an example prize claim button

  1. In the Layers pane, right-click the button layer and then click Create Layer > Logic > Post Message
  2. Set the properties for the postMessage layer, by selecting the post message layer and entering the following details in the property pane:
    1. Label Name: Enter a name for the postmessage layer.
    2. Event and Event Name: Select NamedEvent from the event drop-down and then select popup_button_press as the event name. This ensures that an event is triggered when a player clicks the button.
    3. Mode: Select JSON or String, depending on the format of the data you need to send.
    4. Source: Select Custom to add your own value. In the text editor that appears, enter the message you want to receive.
  3. Save your changes in the Editor.