Handle Prize Redirections From Your Website
Use a postMessage to redirect players from your website rather than from the Xtremepush iframe
By default, when a user wins a prize, the associated redirect URL automatically redirects the user inside the Xtremepush game's iframe.
To handle prize redirections on your own website, you can configure the game to send a postMessage to your parent website instead. This allows your website to handle the redirect information, allowing you to receive the URL and execute your own custom logic.
Prerequisites
- Prize redirect URL: Go to the Prizes tab and for each prize, add a destination URL in the popup_redirect_url field. This is the URL that will be sent to your website.
 - Parent page configuration: Your website must be configured to receive and process the
 postMessageevent from the Xtremepush iframe and the data it contains.
To configure the postMessage for prize redirections, do the following:
- 
Open the Editor in your game campaign.
 - 
Disable the game's default redirect layer. This step prevents the game iframe from handling the redirect automatically:
- 
In the Layout drop-down, select the screen that contains any redirect buttons or links.
 - 
In the Layers pane, select Redirect as shown in the image below:

Select a redirect layer for a prize
 - 
In the properties pane on the left, clear the Enabled checkbox under the Layer Definition.
 
 - 
 - 
In the Layers pane, right-click the button layer for the prize, and then click Create Layer > Logic > Post Message
 - 
Set the properties for the
postMessagelayer, by selecting the post message layer and entering the following details in the property pane:- Label Name: Enter a name for the 
postmessagelayer. - 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.
 - Mode: Select JSON or String, depending on the format of the data you need to send.
 - Source: Select Dynamic and then under Dynamic Text Id, select popup_redirect_url . This configuration sends the URL from the prize's popup_redirect_url field to your parent site, allowing your website to control the redirection logic.
 
 - Label Name: Enter a name for the 
 - 
Save your changes in the Editor.
 
Updated 2 months ago