-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
- SetUserId
- SetUserName
- SetFacebookId
- SetDevicePushToken
- SetBirthday
- SetGender
- Init
- SendEvent
- SendMonetaryEvent
SetUserId is optional method. You may provide your own user id in certain cases (e.g. you want to use Google Play Services/Game Center player id as the unique user id for Gravitum service or you have your own web server with the custom player authentication), otherwise, it will be generated automatically. Just make sure, that the Id you provide will be unique for each user.
*** Parameters ***
string userId - unique user Id depending on your implementation.
*** Example ***
Gravitum.Analytics.SetUserId(user_id);
Gravitum.Analytics.Init ();To provide the user name use SetUserName method with the string name. Unlike the used Id, user name may not be unique. What name to provide is up to you without any restrictions.
*** Parameters ***
string userName - user Name depending on your implementation.
*** Example ***
Gravitum.Analytics.SetUserName(user_name);
Gravitum.Analytics.Init ();Set user Facebook Id via SetFacebookId method call. The common approach if to get the user Facebook Id from Facebook SDK itself and provide it to Gravitum Analytics.
*** Parameters ***
string facebookId - the user Id from Facebook SDK.
*** Example ***
Gravitum.Analytics.SetFacebookId(facebookId);
Gravitum.Analytics.Init ();If you have your own push notifications service implementation, you may use SetDevicePushToken method to provide the unique Id for each user device. If you don't pass any particular token, the Gravitum will generate push token by itself according to the Google Cloud Messaging SenderId you provided with the Init method.
*** Parameters ***
string pushToken - the push token for current user device provided from your push notification service.
*** Example ***
Gravitum.Analytics.SetDevicePushToken(gcmId);
Gravitum.Analytics.Init ();The name of this method speaks for itself. Provide the user birthday via System.DateTime object.
*** Parameters ***
System.DateTime date - date of birth for current user.
*** Example ***
Gravitum.Analytics.SetBirthday(new System.DateTime(1985, 5, 16, 0, 0, 0, 0, System.DateTimeKind.Utc));
Gravitum.Analytics.Init ();The name of this method speaks for itself. Provide the user gender via Analytics.Gender enum constant.
*** Parameters ***
Gravitum.Analytics.Gender gender - the gender of the current user.
*** Example ***
Gravitum.Analytics.SetGender(Gravitum.Analytics.Gender.Male);
Gravitum.Analytics.Init ();The only required method you need to call to set up Gravitum Analytics. Call this in the first scene that is loaded.
*** Example ***
void Start () {
Gravitum.Analytics.SetUserId(user_id);
Gravitum.Analytics.SetUserName(user_name);
Gravitum.Analytics.SetFacebookId(facebookId);
Gravitum.Analytics.SetDevicePushToken(gcmId);
Gravitum.Analytics.SetGender(Gravitum.Analytics.Gender.Male);
Gravitum.Analytics.SetBirthday(new System.DateTime(1985, 5, 16, 0, 0, 0, 0, System.DateTimeKind.Utc));
Gravitum.Analytics.Init ();
}Send an event with provided Id and event data. You will track this event in your Gravitum Developer Dashboard.
*** Parameters ***
string eventId - unique event Id depending on your implementation.
Dictionary<string, object> eventData - You can provide any event data you want as a Dictionary. What data to send with analytics event depends on your game project.
*** Example ***
Dictionary<string, object> eventData = new Dictionary<string, object> ();
eventData.Add ("custom_string_data", "string_data");
eventData.Add ("custom_int_data", 10101);
Gravitum.Analytics.SendEvent ("EventName", eventData);One more specific Analytics event type is Purchase event. The common approach is to track the In-App Purchases with such kind of events. So, send this event every success In-App Purchase. Provide the product Id, price and the currency code of the real In-App Purchase. All these events you will find in one place in Gravitum Dashboard.
*** Parameters ***
string eventId - unique In-App product Id.
float price - In-App product price.
string currency - user locale currency code.
*** Example ***
Gravitum.Analytics.SendMonetaryEvent("coins", 0.99f, "USD");