When using the UserID & Webhook campaign type, game results are not displayed on an in-game leaderboard. Instead, the results are sent directly to your server via a webhook POST request.
This allows you to collect game data in real time and integrate it with your own system — whether that's a database, CRM, analytics platform, or even a simple Google Sheet.
How It Works
Your website embeds the game with a userid parameter
The user plays the game
Upon completion, our system sends the game result to your Webhook URL via POST
Your server processes the data and returns a status code
Your Website Branded Mini-Games
| |
|-- userid (via URL parameter) --------->|
| | User plays the game
|<-- Webhook POST (game result) ---------|
| |
|-- Return "S" (success) --------------->|
URL Parameter
Append the userid as a GET parameter when embedding the game:
For details on generating and managing user IDs, see the User ID Setup Guide.
Webhook Data
The following parameters are sent to your Webhook URL via POST:
Parameter
Required
Description
Example
userid
Yes
Unique user identifier sent by your system
T4g4fLTa
tx_id
Yes
Unique transaction ID for each game play
234234
time
Yes
Date and time when the user played the game
2025-04-10 06:39:23
score
Yes
Score the user achieved
3500
playtime
Yes
Play duration in seconds
20
Data Format
You can choose the data format in the Studio settings:
default — standard form POST (application/x-www-form-urlencoded)
json — JSON format (application/json)
Return Code
Your webhook endpoint must return a status code to confirm receipt:
Code
Description
S
Successfully received and processed
F
Failed. You may include a reason, e.g., F: Score is missing.
Server-Side Example (Node.js)
Google Sheets Integration (No Server Required)
If you don't have a backend server, you can use Google Apps Script to receive webhook data directly into a Google Sheet. This is ideal for promotions, contests, or quick setups.
In your Google Sheet, go to Extensions > Apps Script
Delete any existing code and paste the following:
Click Save (Ctrl+S / Cmd+S)
Step 3: Deploy as Web App
Click Deploy > New deployment
Click the gear icon and select Web app
Configure the settings:
Setting
Value
Description
Webhook receiver
Execute as
Me (your Google account)
Who has access
Anyone
Click Deploy
Authorize the app when prompted (review permissions and allow)
Copy the Web app URL — this is your Webhook URL
The URL looks like: https://script.google.com/macros/s/AKfycb.../exec
Step 4: Set the Webhook URL in Studio
Go to your campaign's UserID & Webhook settings
Paste the Web app URL into the Webhook URL field
Set Result data format to json
Click Update the URL information
Important Notes
Result data format must be set to json — Google Apps Script's JSON.parse(e.postData.contents) expects JSON format. If set to default, the data will not be parsed correctly.
Re-deploy after code changes — Every time you edit the Apps Script code, you must create a New deployment (not just save). The URL changes with each new deployment, so update the Webhook URL in Studio accordingly.
Google account permissions — The script runs under your Google account. The first deployment requires authorization to access your Google Sheets.
Rate limits — Google Apps Script has a daily quota (approximately 20,000 requests/day for free accounts). For high-traffic campaigns, consider a dedicated server instead.
Response time — Apps Script may have a slight delay (1-3 seconds). This does not affect the game experience, as the webhook is sent asynchronously after the game ends.
Data privacy — Game result data is stored in your Google Sheet. Ensure your spreadsheet sharing settings are appropriate for your data privacy requirements.
Testing Your Webhook
You can test your webhook endpoint using curl:
Expected response: S
Building a Leaderboard with Webhook Data
The webhook data you receive can be used to build your own leaderboard. Below are no-code and low-code options that receive scores and display rankings on your website.
Option 1: Zapier + KeepTheScore (Recommended)
Use Zapier to receive the webhook and push scores to KeepTheScore, which provides a hosted leaderboard with real-time updates.
app.post('/webhook', (req, res) => {
const { userid, tx_id, time, score, playtime } = req.body;
// Validate required fields
if (!userid || !tx_id || !score) {
return res.send('F: Missing required fields.');
}
// Store the data in your database
db.insert({ userid, tx_id, time, score, playtime });
return res.send('S');
});
function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = JSON.parse(e.postData.contents);
sheet.appendRow([
new Date(),
data.userid,
data.tx_id,
data.time,
data.score,
data.playtime
]);
return ContentService.createTextOutput('S');
}