3. Send in-game event data
Last updated
Last updated
Sending sufficient in-game event and player attribute data to Airflux is essential for model training and ad display optimization. This step may take approximately 30 minutes to 1 hour, depending on the number of events and attributes you want to track.
To implement session tracking within a Unity project, integrate the following methods into the Airflux SDK as shown below.
The NotifyAppForeground()
function should be called when the app gains focus, signaling the start of a user session. Conversely, NotifyAppBackground()
should be called when the application is sent to the background, indicating the end of the session.
By integrating these calls, Airflux can collect session information, including session count, duration, and maximum session length.
Use the TrackEvent()
function to track key player actions within the game. The in-game event data plays a crucial role in enabling the Airflux AI model to learn player behavior patterns.
Ad Impression
When the ad is shown to the user
Order Completed
When the in-app purchase is completed and the user receives the item (e.g., when a dialog appears confirming the purchase)
Achieve Level
When a stage ends (e.g., Success, Fail, Give-up, Retry)
Spend Credits
When the player spends in-game currency
The TrackEvent()
function should be called when a key event is triggered. Refer to the table below for the detailed requirements for the key components.
category
Required
String
Name of the event
Only underscores are permitted as special characters; colons and other special characters are not allowed. If the collected data exceeds the maximum limit of 128 characters, only the initial 128 characters will be saved.
semanticAttributes
Optional
Dictionary<string, object>
Semantic attributes of the event
Semantic attribute data collection is limited by type: up to 1024 characters for strings, and 64 bits for integers or floats.
customAttributes
Optional
Dictionary<string, object>
Custom attributes of the event
Custom attribute data collection is limited to 2,048 characters; exceeding the limit results in ERROR_MAX_LENGTH_EXCEEDED.
In-game events are essential data for model training. Clearly understand the purpose and timing of collecting each event, and ensure proper implementation for data transmission.
In addition to tracking player actions through in-game events, Airflux also requires player attribute data, such as the player’s current level, in-game currency balance, and other contextual information to train the Airflux AI model. Sufficient player attribute data allows Airflux to fine-segment players and perform inferences for maximum LTV and retention.
Use the following functions to track and player attribute data.
Airflux.SetLevel()
When the player's level is updated
Airflux.SetHardCurrency()
When the player purchased, earned, or spent in-game hard currency (e.g., diamonds), and the balance changed
Airflux.SetSoftCurrency()
When the player purchased, earned, or spent in-game soft currency (e.g., coins), and the balance changed
Airflux.SetInferenceAttribute()
When other player attribute is updated
Attention
Input the in-game currency balance for Currency
. If a player had 500 diamonds and purchased 700 more, Airflux.SetHardCurrency("diamond", 1200)
should be triggered.
If your game issues a unique User ID for each player upon sign-up or sign-in, it is advised to send the data to Airflux. If your game server does not handle User IDs, a unique identifier can be generated upon sign-in and sent to Airflux. The User ID must be sent before the event data.
Attention
If the User ID is not sent before the event data, the User ID cannot be linked to the event data.
Ensure the payload transmitted by the Airflux SDK adheres to the predefined event taxonomy and that the session information, in-game events, and play attribute data are sent to the Airflux server as intended.
Trigger events based on the test scenarios listed below, and check the corresponding events in the [Raw Data]>[App Real-time Log] menu of the Airbridge dashboard. Event data transmitted through the Airflux SDK will be displayed in JSON format. You need to verify that the data type and structure of each field match the predefined format.
Check the following items to ensure that the taxonomy definitions match the values configured in the SDK.
eventData.goal.category
Verify that the event name exactly matches the string defined in the taxonomy.
semanticAttributes
• All keys must match those defined in the taxonomy. • Value types must match the defined types (string, number, boolean). • For revenue events (ad_impression, order_completed), values must be positive numbers.
originalCurrency
Must be a 3-letter uppercase code defined by ISO-4217 (e.g., USD, KRW)
customAttributes
Key: string / Value: allowed types (string, number, boolean)
When the following key events are triggered, verify that they are properly logged in the [App Real-time Log] page without omission and that related attributes are accurately included.
App installed
Install
App launched
Open
Ad viewing completed
Ad Impression
In-app purchase completed
Order Completed
Level achieved
Achieve Level
Currency spent
Spend Credits
In particular, revenue-related events such as Ad Impression and Order Complete are critical for the Airflux model training. Double-check the following points:
Ad Impression
Confirm the revenue value in eventData.originalValue
.
Confirm the currency in originalCurrency
.
Confirm the ad type in customAttributes.ad_type
.
Order Completed
Confirm the revenue value in eventData.originalValue
.
Confirm the currency in originalCurrency
.
If you are sending User IDs, make sure the externalUserID
is properly logged.
Collecting and sending the event data specified in the to Airflux is essential for using Airflux.
Click to view the events and key attributes that must be sent to Airflux.