Skip to main content
Start sending your customers’ events from your Flutter app to Gameball. By tracking actions such as purchases, sign-ups, and other key interactions, you can tailor rewards and communications to engage your customers more effectively.
For detailed event tracking implementation, please refer to the Tracking Customer Events tutorial and Events API Reference.

Event Tracking Implementation

To track customer events in your Flutter app, you need to create an Event object and send it using the sendEvent method.

Create Event Object

First, create an Event object with the customer ID and event data:
Event eventBody = Event(
  customerId: "customer_id",
  events: {
    "event_name": {
      "property1": "value1",
      "property2": "value2"
    }
  }
);

Send the Event

Using the previously created GameballApp instance or by creating a new one, call the sendEvent() method as shown below:
// SendEventCallback
sendEventCallback(response, error){
  if(error == null && response != null){
    // TODO Handle on success result.
  }
  else{
    // TODO Handle on failure result.
  }
}
    
gameballApp.sendEvent(eventBody, sendEventCallback);

Event Types

Gameball supports various event types that you can track:

Best Practices

1

Consistent Event Naming

Use consistent naming conventions for your events across all platforms (Web, iOS, Android, Flutter)
2

Include Relevant Properties

Add relevant properties to events to provide context and enable better analytics
3

Handle Errors Gracefully

Implement proper error handling in your event callback functions
4

Test Event Tracking

Test event tracking in development before deploying to production

Event Properties

When creating events, you can include various properties to provide context:
Event eventBody = Event(
  customerId: "customer_123",
  events: {
    "purchase": {
      "orderId": "ORD-12345",
      "amount": 99.99,
      "currency": "USD",
      "products": [
        {
          "productId": "PROD-001",
          "name": "Sample Product",
          "price": 99.99,
          "quantity": 1
        }
      ]
    }
  }
);
For a complete list of supported event types and properties, refer to the Events API Reference.