Setup
1. Download the tracker from: https://github.com/cooladata/cooladata-unity
2. Add the Unity package to your project.
3. Open the unity package with the unity IDE, or add the package as an asset to your project.
4. Add the following import to classes that use the CoolaData tracker:
using com.cooladata.tracking.sdk.unity;
5. Create and initialize the CoolaData tracker instance:
CoolaDataTracker.getInstance().setup(String appKey, String serviceEndPoint, String userId)
Tracking Events
After the CoolaData Tracker SDK is properly set up, you are ready to report events from your application. To start doing so, you need to call the trackEvent function with suitable parameters on every user’s action that you would like to track.
- Prepare the parameters
Dictionary<string,string> myMap = new Dictionary<string, string>(); myMap.Add("unity param 1", "value1");
- Add the event to the queue
CoolaDataTracker.getInstance().trackEvent("eventName", myMap);
Other event tracking examples:
CoolaDataTracker.getInstance().trackEvent(eventName, eventProperties); CoolaDataTracker.getInstance().trackEvent(eventName, userId, eventProperties); CoolaDataTracker.getInstance().trackEvent(eventName, eventProperties, eventId, callback); CoolaDataTracker.getInstance().trackEvent(eventName, userId, eventProperties, eventId, callback);
Parameters Descriptions:
Parameter | Mandatory | Description |
---|---|---|
eventName | Yes | The name of the event to report. |
userId | No | The User ID relevant for this instance of the CoolaDataTracker. Can be provided either in the setup or the trackEvent method. If no userId is provided one will be generated automatically. |
eventProperties | No | The custom properties to be sent with the event. This parameter is optional. The parameters should be in the Dictionary |
eventId | No | An ID of the event. |
Callback | No | a CoolaDataDeliveryResult type result that will be returned when the data is sent. |