Gameball Developers Guide
v3.0
v3.0
  • Introduction
  • What's New in V3.0
  • Installing Gameball
    • Web
      • Show Gameball Customer Widget
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Go-Live Checklist
    • iOS
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • Android
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • React Native
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
      • Migration from v1 to v2
    • Flutter
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Referrals
      • Go-Live Checklist
    • Generic Mobile App
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
    • Retail & Modern POS
      • Initialize Gameball Customer Profile
      • Track Orders & Cashback Reward
      • Track Refunds
      • Enable Redemption
        • Prepare POS for Redemption
        • Using Virtual ID
          • Using Virtual Card
  • REST API
    • Overview
      • Server-Side SDKs
    • Authentication
    • API Reference
      • Customer
      • Event
      • Transactions
      • Order
      • Coupons
      • Leaderboard 👑
      • Notifications 👑
      • Configurations 👑
      • Batches 👑
        • Batch Operations Data
      • OTP
      • Partner 🤝
        • Client 🤝
        • Redemption Rule 🤝
        • Cashback Rule 🤝
    • Webhooks
      • Notifications Webhook
      • Customer Profile Webhook
    • Errors
    • Object Reference
  • Tutorials
    • Build Custom UI Elements 👑
      • Display Reward Campaign Progress
      • Show VIP Tiers
      • Show Customer Points Balance
      • Build Leaderboards
      • Show Notifications Inbox
      • Adapt UI to Configurations
      • Advanced UI Techniques
        • Increase Sales with Cashback UI Elements
        • Derive Engagement with Rewards Campaigns UI Elements
    • Tracking Customer Events
    • Build your Own Notification System
    • Checkout Integration Example
    • Redemption Integration Options
      • Redeem with coupon system
        • Integrate your coupon system
          • Example using e-commerce platform(WooCommerce)
          • Example using a custom coupon system
        • Build couponing experience
          • Using Gameball widget
          • Build custom experience
            • Showing customers available points
            • Allowing customers to create coupons
            • Apply the discount code to your cart
        • Coupon integration reference
      • Redeem with direct debt
        • Get customers points balance
        • Redeem customer points
  • Third Party Integrations
    • Segment Integration
Powered by GitBook
On this page
  • Available Endpoints
  • POST - Track Event
  • Request
  • Usage Examples
  • Remarks
  1. REST API
  2. API Reference

Event

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

PreviousCustomerNextTransactions

Last updated 1 year ago

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 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 .

Place Order Event could be sent along with Endpoint and Points using the Endpoint specifically designed for E-Commerce Solutions.

POST - Track Event

This API call is used to send an event to Gameball where the received event will be evaluated and counted toward customer reward campaigns.

https://api.gameball.co/api/v3.0/integrations/event

mobile or email should be sent along with the playerUniqueId in case (only if) your account supports channel merging.

Request

Header

Attribute

Type

Required

Description

APIKey

string

Yes

Client API key

Body

Attribute

Type

Required

Description

playerUniqueId

string

Yes

Unique identifier for the customer at Gameball

mobile

string

No

Customer's unique mobile number. (Sent in case your account supports channel merging)

email

string

No

Customer's unique email. (Sent in case your account supports channel merging)

events

object

Yes

In case the customer doesn't exist on Gameball before sending the Event API call, the customer will be created automatically.

event Object

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

"buy": {
  "product_id": "a123456",
  "price": 30,
  "product_category": "fashion"
  "product_tags": ["men", "new_collection"]
}

Sample Request Body

{
  "events": {
    "place_order": {    // Events with metadata
      "total_amount": "100",
      "category": [
          "electronics",
          "cosmetics"
      ]
    },
    "review": { } // For events with no metadata
  },
  "playerUniqueId": "player123"
}

Usage Examples

Example One

The below represents events done by a customer 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 customer

    2. category: Type of products being bought by the customer

  2. Event review: (An event with no metadata)

curl --location --request POST 'https://api.gameball.co/api/v3.0/integrations/event' \
--header 'apiKey: 807b041b7d35425988e354e1f6bce186' \
--header 'Content-Type: application/json' \
--data-raw '{
  "events": {
    "place_order": {    // Events with metadata
      "total_amount": "100",
      "category": [
          "electronics",
          "cosmetics"
      ]
    },
    "review": { } // For events with no metadata
  },
  "playerUniqueId": "player123"
  }'
Gameball::Event.send_event({
	events:{
		place_order:{
			total_amount:"100",
			category:[
				"electronics",
				"cosmetics"
			]
		},
		review:{}
	},
	playerUniqueId:"player123"
})
$eventRequest = \Gameball\Models\EventRequest::factory("player123");
$eventRequest->addEvent('place_order');
$eventRequest->addMetaData('place_order','total_amount','100');
$eventRequest->addMetaData('place_order','category',array("electronics","cosmetics"));
$eventRequest->addEvent('review');
$response = $gameball->event->sendEvent($eventRequest);
event = gameball.eventObject("player123")
event.add_event(
     'place_order',
      {
         "total_amount":"100",
         "category":["electronics","cosmetics"]
      })
event_request = gameball.send_event(event)
var placeOrderEvent = new Event(){
	Name="place_order"
};

placeOrderEvent.AddMetadata("total_amount", 100);
placeOrderEvent.AddMetadata("category", new string[]{"electronics","cosmetics"});

var reviewEvent = new Event(){
	Name="review"
};
var eventRequest = new EventRequest(){
	PlayerUniqueId="player123"	
};

eventRequest.AddEvent(placeOrderEvent);
eventRequest.AddEvent(reviewEvent);

var response = Gameball.SendEvent(eventRequest);

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 a customer, 1 for standard and 2 for deluxe rooms

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
    "events": 
        {
            "reserve": {
                "rooms": 2
            }
        },
    "playerUniqueId": "player123"
}' -v -i 'https://api.gameball.co/api/v3.0/integrations/event'
Gameball::Event.send_event({
	events:{
		reserve:{
			rooms:2
		}
	},
	playerUniqueId:" player123"
	
})
$eventRequest = \Gameball\Models\EventRequest::factory("player123");
$eventRequest->addEvent('reserve');
$eventRequest->addMetaData('reserve','rooms','2');
$response = $gameball->event->sendEvent($eventRequest);
event = gameball.eventObject("player123")
event.add_event(
     'reserve',
      {
         "rooms":2
      })
event_request = gameball.send_event(event)
var reserveEvent = new Event(){
	Name="reserve"
};

reserveEvent.AddMetadata("rooms", 2);

var eventRequest = new EventRequest(){
	PlayerUniqueId="player123"	
};

eventRequest.AddEvent(reserveEvent);

var response = Gameball.SendEvent(eventRequest);

Example three

Same as the previous example but with channel merging configurations applied.

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
    "events": 
        {
            "reserve": {
                "rooms": 2
            }
        },
    "playerUniqueId": "player123",
    "mobile": "+1234567"
}' -v -i 'https://api.gameball.co/api/v3.0/integrations/event'
Gameball::Event.send_event({
	events:{
		reserve:{
			rooms:2
		}
	},
	playerUniqueId:"player123"
	mobile: "+1234567"
})
$eventRequest = \Gameball\Models\EventRequest::factory("player123", "+1234567");
$eventRequest->addEvent('reserve');
$eventRequest->addMetaData('reserve','rooms','2');
$response = $gameball->event->sendEvent($eventRequest);
event = gameball.eventObject("player123",mobile= "+1234567")
event.add_event(
     'reserve',
      {
         "rooms":2
      })
event_request = gameball.send_event(event)
var reserveEvent = new Event(){
	Name="reserve"
};

reserveEvent.AddMetadata("rooms", 2);

var eventRequest = new EventRequest(){
	PlayerUniqueId="player123",
	Mobile= "+1234567"	
};

eventRequest.AddEvent(reserveEvent);

var response = Gameball.SendEvent(eventRequest);

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 provided as an array of strings as follows “key”: [“value1”, “value2”, “value3”, …]

  • Events that are tracked while Gameball is disabled are tracked but not used

Collection of customer to be sent to Gameball.

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 .

article
below
Cashback
Hold
Order
Understand your customers' events
Track Event
events