Collect Data

TentuPlaySDKDemo

  1. TentuPlaySDKPlayerController is a component of the Player.

  2. You can refer to TentuPlaySDKPlayerController.cs for example on TPStashEvent.

SDK for Data Collection

Upon game events, call adequate methods of TPStashEvent class.

Log join events and login events

Below is an example of a script that initializes TENTUPLAY and logs the join events of new users and login events. You can collect the data by writing one line of code for each event.

using UnityEngine;
using TentuPlay;
using TentuPlay.Api; // for collecting and uploading data
using UnityEngine.UI;
public class ExampleJoinScript : MonoBehaviour
{
// define variables
private string player_uuid = "TentuTestPlayer"; // player_uuid as a unique identifier of a player
// Start is called before the first frame update
void Start()
{
// initialize
TPStashEvent myStashEvent = new TPStashEvent();
// Join method when calling a new subscription event
myStashEvent.Join(player_uuid : player_uuid);
// Login method when calling user's login event
myStashEvent.PlayerLogin(player_uuid : player_uuid,
app_version : "1.0" // default is null. (optional)
);
}
}

If the data upload is successful, the events will be logged to the Unity Editor console, as shown below.

Go to TentuPlay API Documentation for the details.

Do you need help?

Do you have questions? Join TENTUPLAY Discord if you have any questions.