Seamless web-to-game integration
How it works
Seamless web-to-game integration allows you to configure sending data from your website to the game in the URL parameters. You can transmit a user’s authorization token, marketing campaign data, or other information.
User flows
There are the following user scenarios when implementing seamless web-to-game integration:
- Clicking a link to download the launcher installer from the website.
- Clicking a link to the launcher from the website.
- Launching the game from the launcher.
When a user clicks a link to download the launcher installer from the website:
- The user opens the website.
- The user follows the link to the launcher installer.
- The user downloads the launcher installer with the link containing a one-time password.
- The user installs the launcher.
- The launcher receives the value of the
common_payload
parameter through the one-time password. - The user clicks Play in the launcher.
- The launcher checks the presence and expiration of the
common_payload
parameter:- If the check is successful, the launcher starts the game with the arguments obtained from the
common_payload
parameter. - If the check is unsuccessful:
- If the website URL is configured in the Publisher Account within the executable file name, the launcher redirects the user to that address.
- If the website URL is not configured in the Publisher Account within the executable file name — the launcher starts the game without the
common_payload
argument.
- If the check is successful, the launcher starts the game with the arguments obtained from the
When a user clicks a link to the launcher from the website and the launcher has already been installed, the following flow occurs:
- The user opens the website.
- The user clicks a link to the launcher.
- The launcher saves the value of the
payload
,common_payload
andexpires_jn
parameters from the URL. - The user clicks Play in the launcher.
- The launcher checks the presence and expiration of the
payload
andcommon_payload
parameter:- If the check is successful, the launcher starts the game with the arguments obtained from the
payload
andcommon_payload
parameters. - If the check is unsuccessful:
- If the website URL is configured in Publisher Account within the executable file name, the launcher redirects the user to that address.
- If the website URL is not configured in Publisher Account within the executable file name — the launcher starts the game without the
payload
andcommon_payload
arguments.
- If the check is successful, the launcher starts the game with the arguments obtained from the
When a user launches the game from the launcher, the following flow occurs:
- The user opens the launcher.
- The user clicks Play in the launcher.
- The launcher checks the presence and expiration of the
payload
andcommon_payload
parameter:- If the check is successful, the launcher starts the game with the arguments obtained from the
payload
andcommon_payload
parameters. - If the check is unsuccessful:
- If the website URL is configured in Publisher Account within the executable file name, the launcher redirects the user to that address.
- If the website URL is not configured in Publisher Account within the executable file name, the launcher redirects the user to that address — the launcher starts the game without the
payload
andcommon_payload
arguments.
- If the check is successful, the launcher starts the game with the arguments obtained from the
How to get it
To set up seamless web-to-game integration:
- Configure settings in Publisher Account.
- Add a link to your website.
- Implement processing of the data received in the payload parameter on the game side.
Configuration of settings in Publisher Account
- Open your project in Publisher Account.
- Click Launcher in the side menu.
- Find the launcher on the dashboard, and click Edit launcher.
- In the Games section, click Set up to the right of your game.
- Go to the Builds section.
- Go to the Executable files tab.
- Add the
--x_payload_url
argument to the Executable file name field for each operating system. In the argument value, pass the website URL where the link or button is located. The value should be encoded using Base64.
For example, if the executable file name is game.exe
and the game website URL is http://example.com/start_play
, then enter game.exe –x_payload_url aHR0cDovL2V4YW1wbGUuY29tL3N0YXJ0X3BsYXk=
in the Executable file name field.
Adding a link to the website
Add a link or button to your website that will open the URL in the xl-<launcher-id>://game/<game-id>?payload=<payload>&common_payload=<common_payload>&expires_in=<expires_in>
format, where:
<launcher-id>
and<game-id>
— identifiers of the launcher and game that you can find in the URL of your Publisher Account:https://publisher.xsolla.com/<merchant-id>/projects/<project-id>/new-launcher/<launcher-id>/game/<game-id>
.<payload>
— the data that needs to be passed to the game.<common_payload>
— the user data that needs to be passed to the launcher, which is common for all games.<expires_in>
— the expiration time of the data passed in thepayload
andcommon_payload
parameters in Unix time format in milliseconds.
- javascript
function getAuthToken() {
return 'YOUR DATA HERE';
}
function getDeeplink(launcherID, gameID) {
const encodedPayload = btoa(getAuthToken());
const expiresIn = new Date();
expiresIn.setHours(expiresIn.getHours() + 1); // Payload data will be fresh for 1 hour
return `xl-${launcherID}://game/${gameID}?payload=${encodedPayload}&expires_in=${expiresIn.getTime()}`;
}
// Put that `href` to button or link address
const href = getDeeplink(123, 4567);
Integration on the game side
The launcher passes the data received in the payload
parameter as the value of the –xsolla-payload
command line argument, as shown in the example below. It also checks for the presence and lifespan of data passed in the common_payload
parameter and passes it as the value of the –xsolla-common-payload
command-line argument, as shown in the example below.
Example of starting a game when data is encrypted using Base64:
game.exe ---xsolla-payload <payload> --xsolla-common-payload <common_payload> WU9VUiBEQVRBIEhFUkU=
Found a typo or other text error? Select the text and press Ctrl+Enter.