Branded Mini-Games Support
  • Welcome
  • Branded Mini-Games
    • Create a campaign
      • Method 1
      • Method 2
      • Campaign Types
        • Website
        • Mobile App
        • Playable ads
        • Brand Hosting
    • Game Settings
      • Game Customization: Easy Mode
      • Game Customization: Pro Mode
        • Other Features
      • How to Modify Graphics
      • Configurations
        • Minimum Game Score Setting
        • Using Hearts (Game Life)
      • Activating the prepared game
      • Instant Win
    • Campaign Settings
      • Campaign Profiles and SEO
      • Campaign URL
      • CNAME
      • How to Add a Game to Your Website
      • Deleting Games
    • Page Settings
      • Landing Page
      • Login
      • Results and Calls to Action
        • Leaderboard
        • No Leaderboard
        • Sharing
        • Call-to-Action
      • Changing Background Music and Favicon
      • Coupon
      • Skin Editor
    • Website
      • Website -> Leaderboard
      • Website -> UserID & Leaderboard
      • Website -> Participate & Win
      • Website -> UserID & Webhook
    • Mobile App Settings
      • Android App
      • iPhone iOS App
      • Mobile App -> Leaderboard
      • Mobile App -> UserID & Leaderboard
      • Mobile App -> UserID and Webhook
      • Close button
    • Play & Redeem
      • Select a Service Group
      • Choosing a Login Method & Service Start URL
      • Exchange game points to Shopping credits
      • Exchange game points to Coupons
      • Daily Missions settings for the game
    • UserID & Webhook
      • Website
      • Mobile App
      • Brand Hosting
    • Playable Ads
      • Customer acquisition through events
      • App installation
    • Data & Export
      • Participation
      • Sign up
      • Coupon Management
    • Google Analytics
    • Paid Plan & Publish
      • Publish
      • Subscribing to a Paid Plan
      • Purchase additional CPP
      • Invoice
      • Change credit card, update billing information, cancel service
    • Brand Hosting
      • Add game
      • Server setting test
      • Webhook and return values
  • Run actual Branded Mini-Games.
  • Terms of Use
    • Terms of Use
    • Privacy policy
    • Cookie Policy
    • Data Processor Agreement
    • GDPR
      • Understanding GDPR: Overview of Data Protection Regulation
      • Personal Data and Compliance: Key Considerations
      • GDPR Compliance in Studio Operations: User Sign-Up and Privacy Policies
      • Data Management: Retention, Analytics, and Reporting
    • Coupon Town - Terms and Conditions
  • Game Development Request
  • Deutsche / German
    • Marken-Mini-Spiele
  • Français / French
    • Mini-jeux de Marque
  • Italiano / Italian
    • Mini-Giochi Brandizzati
  • Español / Spanish
    • Mini-Juegos de Marca
  • Português / Portuguese
    • Mini-Jogos de Marca
  • Türkçe / Turkish
    • Markalı Mini Oyunlar
  • हिन्दी / Hindi
    • ब्रांडेड मिनी गेम्स
  • 한국어 / Korean
    • 브랜드 미니 게임
  • 日本語 / Japanese
    • ブランドミニゲーム
  • 简体中文 / Chinese
    • 品牌小游戏
  • Arabic (العربية)
    • ألعاب صغيرة ذات علامة تجارية
Powered by GitBook
On this page
  1. Branded Mini-Games
  2. Brand Hosting

Webhook and return values

PreviousServer setting testNextRun actual Branded Mini-Games.

Last updated 3 months ago

The brand must transmit the userid to the server where the HTML5 game files are hosted via the Webhook server. Once the game ends, the values of userid and GameResult are returned to the Webhook server. Through the userid, the brand can identify who the game player is and receive the GameResult information of the respective player via the Webhook server. The setup of such a Webhook server must be carried out by the brand itself.

You can use the userid and Webhook to send game-related data to the brand's Webhook server after the game on Brand hosting.

Basic scenario

  1. When a mini-game is launched on the brand’s server, the user ID (userid) is retrieved from the brand’s Webhook server via a GET request and passed to the mini-game execution URL.

  2. The mini-game runs within the web page environment of the brand’s server.

  3. After the game ends, the game score is displayed on the results screen.

  4. The brand’s Webhook server receives game-related data through the Webhook.

  5. Based on the received data, the brand operates its own leaderboard and rewards programme.

Setup process

  1. The brand must set up a Webhook program on their server to receive game result data.

  2. You need to enter the Webhook server’s address in the Installation section of Studio.

  3. Download the game file with the completed setup as a ZIP file.

  4. Copy the ZIP file to the brand server and complete the necessary setup.

  5. The brand applies the received data to their own leaderboard or reward program based on the data transmitted via Webhook.

Instructions on how to apply

When running the mini-game in a web browser, the ‘userid’ parameter and its value must be included using the GET method.

Parameter

Name
Description
Format
Sample

userid

Unique ID generated from the brand's system

Alphanumeric (case-sensitive) + up to 20 digits

T4g4fLTaorjames

Example, Original campaign URL address https://brand.server.com/ The brand's system must call this URL and send the "userid".

https://brand.server.com/?php=userid=T4g4fLTa

After the game, the result value is sent to the brand's Webhook URL

After the game, the result value and various data are received by the brand’s server through the Webhook created by the brand.

Name
Description
Sample

userid

User's unique ID

T4g4fLTa or james

time

Datetime when the game player attempted to play

Unix Timestamp (Milliseconds)

result

Game Score obtained by the game player

3500

playtime

Duration of play by the game player (in seconds)

20

PHP example

Here is a PHP example that receives the result of a mini-game in JSON format and inserts it into a MySQL database.

<?php
// Include the database connection file
require_once "connect.php";

header("Content-Type: application/json");

// Get JSON data from the request
$data = json_decode(file_get_contents("php://input"), true);

// Check if JSON data is valid
if (!$data) {
    http_response_code(400);
    echo json_encode(["error" => "Invalid JSON format"]);
    exit;
}

// Extract values from the JSON payload
$result = $data["result"] ?? null;
$playtime = $data["playtime"] ?? null;
$time = $data["time"] ?? null;
$userid = $data["userid"] ?? null;

// Validate required fields
if ($result === null || $playtime === null || $time === null || $userid === null) {
    http_response_code(400);
    echo json_encode(["error" => "Missing required fields"]);
    exit;
}

try {
    // Save data to MySQL database
    $stmt = $pdo->prepare("INSERT INTO game_results (userid, result, playtime, time) VALUES (:userid, :result, :playtime, :time)");
    $stmt->execute([
        ":userid" => $userid,
        ":result" => $result,
        ":playtime" => $playtime,
        ":time" => $time
    ]);

    // Return success response
    echo json_encode(["message" => "Data saved successfully"]);
} catch (PDOException $e) {
    http_response_code(500);
    echo json_encode(["error" => "Database error"]);
}
?>

SQL

CREATE TABLE game_results (
    id INT AUTO_INCREMENT PRIMARY KEY,
    userid VARCHAR(255) NOT NULL,
    result INT NOT NULL,
    playtime FLOAT NOT NULL,
    time BIGINT NOT NULL,
    received_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

.

The brand creates a mini-game using Studio