Event
This API endpoint allows you to track and send your players' events on your platform to Gameball.

Available Endpoints

Type
Description
Endpoint
POST
/integrations/event
The event APIs help you record any actions your user performs, along with any properties or metadata that describe the action. For further elaboration on events, check this article in our Help Center.
Each action is known as an event. Each event has a name, like place_order, and metadata, for example a place_order event might have properties like amount or source. Calling events is one of the first steps to getting started with Gameball.
The event API call accepts a collection of event to help tracking multiple user actions. Event object is described below.
Place Order Event could be sent along with Cashback Endpoint and Hold Points using the Order Endpoint specifically designed for E-Commerce Solutions.
Events can be sent along with points reward and points redemption using Actions Composite API endpoint.

POST - Track Event

This API call is used to send an event to Gameball where the received event will be evaluated and counted toward player challenges.
1
https://api.gameball.co/api/v3.0/integrations/event
Copied!

Request

Attribute
Type
Required
Description
APIKey
string
Yes
Client API key

Body

Attribute
Type
Required
Description
playerUniqueId
string
Yes
Unique identifier for the player at Gameball
events
object
Yes
Collection of player events to be sent to Gameball.
In case the player doesn't exist on Gameball before sending the Event API call, the player will be created automatically on Gameball.

event Object

The Event object is how you record any actions your users perform, along with any metadata that describes the action. For further elaboration on events check Understand your players' events.
Metadata are extra pieces of information you can tie to events you track. They can be none or anything that will be useful while analyzing the events later. We recommend sending properties whenever possible because they give you a more complete picture of what your users are doing. Every Metadata can be a number, a string or an array of values.

Event and Metadata example:

Event Name
Key
Example Value
buy
product_id
"a123456"
price
30
product_category
"fashion"
product_tags
"men & new_collection"

Sample Event Object

1
"buy": {
2
"product_id": "a123456",
3
"price": 30,
4
"product_category": "fashion"
5
"product_tags": ["men", "new_collection"]
6
}
Copied!

Sample Request Body

1
{
2
"events": {
3
"place_order": { // Events with metadata
4
"total_amount": "100",
5
"category": [
6
"electronics",
7
"cosmetics"
8
]
9
},
10
"review": { } // For events with no metadata
11
},
12
"playerUniqueId": "player123"
13
}
Copied!

Usage Examples

Example One

The below represents events done by a player with playerUniqueId “player123” on two events:
    1.
    Event “place_order”: (An event that has 2 metadata keys)
      1.
      total_amount: Total money paid by the player
      2.
      category: Type of products being bought by player
    2.
    Event review: (An event with no metadata)
cURL
1
curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
2
"events": {
3
"place_order": { // Events with metadata
4
"total_amount": "100",
5
"category": [
6
"electronics",
7
"cosmetics"
8
]
9
},
10
"review": { } // For events with no metadata
11
},
12
"playerUniqueId": "player123"
13
}' -v -i 'https://api.gameball.co/api/v3.0/integrations/event'
Copied!

Example Two

The below example shows how the event endpoint could be used to trigger an event to reserve 2 rooms:
    1.
    Event reserve: An event with one metadata key
      1.
      rooms: Types of rooms booked by player, 1 for standard and 2 for deluxe rooms
cURL
1
curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
2
"events":
3
{
4
"reserve": {
5
"rooms": 2
6
}
7
},
8
"playerUniqueId": "player123"
9
}' -v -i 'https://api.gameball.co/api/v3.0/integrations/event'
Copied!

Remarks

    API consumer can provide any number of events given that each event name is not replicated
    API consumer can provide from 0 to all event metadata keys, however the keys must not be replicated. If the consumer has multiple values for a single metadata key it should be provide as an array of strings as follows “key”: [“value1”, “value2”, “value3”, …]
Last modified 1mo ago