Windows Phone 8 Basic Methods

Attention! The support of the SDK for this platform has been suspended!


To collect basic metrics, add the following function calls to Application Activate and Application Deactivate handlers:

DevToDev.SDK.OnActivate();

and

DevToDev.SDK.OnDeactivate();

Tutorial steps

The event allows to filter users in the course of passing the tutorial.The event is sent upon passing every step.

Use the following constants to specify basic events of tutorial steps:

  • DevToDev.TutorialState.Start or -1 - at the beginning, before the first step is completed;

  • DevToDev.TutorialState.Finish or -2 - instead of the last step number;

  • DevToDev.TutorialState.Skipped or 0 - if user skipped the tutorial.

In other cases use step numbers. Make sure you use numbers above 0 numerating the steps.

/**
*  <param name="state"> The latest successfully completed tutorial step </param>
*/
DevToDev.SDK.Tutorial(int state)

Levelling up

You can analyse the distribution of the players over the levels. The event is sent over reaching a new level by a player.

/**
* <param name="level"> Level reached by the player </param>
*/

DevToDev.SDK.Level(int level);

Example:

DevToDev.SDK.Level(4);

To track the average account balance of in-game currency by the end of each level, please also provide the list of currency names and their amount.

/**
* <param name="level"> Player level </param>
* <param name="resources">Dictionary with the currency names and amounts</param>
*/

Dictionary<string, int> resources = new Dictionary<string, int>();
resources.Add("Currency name 1", 1000);
resources.Add("Currency name 2", 10);
DevToDev.SDK.Level(level, resources);

To track the average amount of in-game currency earned or purchased during a level, it is necessary to send a special event after each time an in-game account is replenished.

/**
* <param name="currencyName">Currency name (max. 24 symbols)</param>
* <param name="currencyAmount ">The amount an account has been credited with</param>
* <param name="accrualType">The way the currency was obtained: earned or purchased</param>
*/

DevToDev.SDK.CurrencyAccrual(string currencyName, float currencyAmount, AccrualType accrualType);

AccrualType can take one of following values:

public enum AccrualType {
                          Earned,
                          Purchased
};

Payment

To track the payments, add this event right after the platform confirms that the payment went through.

/**
* Register transactions made through the platform's payment system.
*  <param name="orderId"> Transaction id </param>
*  <param name="price"> Product price (in user's currency) </param>
*  <param name="productId"> Product id (product name) </param>
*  <param name="currencyCode"> Transaction currency (ISO 4217 format)</param>
*/

DevToDev.SDK.RealPayment(string orderId, float price, string productId, string currencyCode)

Example:

DevToDev.SDK.RealPayment("1836535032137741465" , 2.99f , "productId" , "USD" );

In-app purchases

To track expenditures of in-game currency and the popularity of the products, add this event right after a purchase is made.

/**
* <param name="purchaseId"> Unique purchase ID (max. 32 symbols)</param>
* <param name="purchaseType"> Purchase type or group (max. 96 symbols)</param>
* <param name="purchaseAmount"> Number of purchased goods </param>
* <param name="purchasePrice"> Cost of purchased goods (total cost - if several goods were purchased)</param>
* <param name="purchasePriceCurrency"> Currency name (max. 24 symbols)</param>
*/

DevToDev.SDK.InAppPurchase(string purchaseId, string purchaseType, int purchaseAmount,int purchasePrice, string purchasePriceCurrency)

Example:

DevToDev.SDK.InAppPurchase("sword", "weapons", 1, 200, "coins");

In case a product was bought for several game currencies at onсe, it is necessary to make a hashmap including the names and amounts of the paid currencies.

Dictionary<string, int> resources = new Dictionary<string, int>();
resources.Add("currency_1", 120);
resources.Add("currency_2", 29);
//…and so on…

DevToDev.SDK.InAppPurchase(string purchaseId, string purchaseType, int purchaseAmount, Dictionary<string, int> resources);

Custom Events

If you want to count the events which are not among basic, use custom events.

The event must have a unique name and can include up to 10 parameters. The maximum length of the event name is 72 symbols.
Every parameter inside one event must have unique name. The maximum length of the parameter name is 32 symbols. 
The values of parameters can be String or number type (int, long, float, double). The maximum length of parameter value is 255 symbols. 

Attention! No more than 300 variants of custom event names can be used for one project. Try to enlarge events in meaning by using event parameters. Events that didn't get into the limit of unique event names will be discarded.

For a string parameter it is acceptable to use not more than 50000 of unique values for the whole event use history. In case the limit of unique values is exceeded the parameter is ignored. 
Therefore we recommend not to set user IDs and Unix time as parameter values of custom events. Try to integrate parameter values if they have a very large variability. Otherwise it will be very difficult to analyse the data or after some time it may be even ignored 
We strongly recommend not to change the type of data transferred in the parameter over time. In case you change the data type in parameter, in devtodev database it will appear one more parameter in the event with the same name but with different data type. The report building with such parameter will be quite difficult. 

/**
* <param name="eventName"> Event name </param>
*/

DevToDev.SDK.CustomEvent(string eventName);

Example:

DevToDev.SDK.CustomEvent("bonus_used");

10 parameter names may be associated with any event:

/**
* <param name="eventName">Event name</param>
* <param name="eventParams">Event parameters</param>
*/

DevToDev.SDK.CustomEvent(string eventName, CustomEventParams eventParams)

Example:

var cep = new CustomEventParams();
cep.AddParam("bonus_name", "your_awesome_bonus");
DevToDev.SDK.CustomEvent("bonus_used", cep);
Analytics Integration
Secondary Methods