The basic methods of devtodev SDK for Adobe Air

Tutorial steps

The event allows to evaluate the effectiveness of the tutorial steps system. The event should be sent at the end of each tutorial step indicating the number of every passed step as a parameter. 

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

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

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

  • 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.

Attention! The logic of the use of the SKIPPED constant in the Tutorial steps event is provided only in case a user has completely refused to pass the tutorial. After SKIPPED is used, no other values of the Tutorial steps event must be received.

/**
* The event allowing to track the stage of tutorial a player is on.
* @param tutorialStep - the latest successfully completed tutorial step.
*/
DevToDev.tutorialCompleted(tutorialStep:int);

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.

/**
* Player has reached a new level
* @param level - level reached by the player.
*/
DevToDev.levelUp(level:int);

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.

/**
* Player has reached a new level
* @param level - level reached by the player.
* @param resources - dictionary with the currency names and amounts
*/
var resources: Dictionary = new Dictionary();
resources["Currency name 1"] = 1000;
resources["Currency name 2"] = 10;
DevToDev.levelUpWithResources(level:int, resources:Dictionary);

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 currencyName - currency name (max. 24 symbols)
* @param currencyAmount - the amount an account has been credited with
* @param accrualType - the way the currency was obtained: earned or purchased
*/
DevToDev.currencyAccrual(currencyName:String, currencyAmount:Number, accrualType:AccrualType);

accrualType can take one of following values:

AccrualType.EARNED;
AccrualType.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 paymentId - transaction ID
* @param inAppPrice - product price (in user's currency)
* @param inAppName - product name
* @param inAppCurrencyISOCode - transaction currency (ISO 4217 format)
*/
DevToDev.realPayment(paymentId:String, inAppPrice:Number, inAppName:String,
                     inAppCurrencyISOCode:String);

How to find the transaction ID in iTunes transaction?

Unique order identifier is a value of "transactionIdentifier" property in SKPaymentTransaction object inside the receipt of completed transaction.

How to find the transaction ID in GooglePlay transaction?

Find the INAPP_PURCHASE_DATA object In the JSON fields that are returned in the response data for a purchase order. A unique transaction identifier is the value of orderId property in INAPP_PURCHASE_DATA object. If the order is a test purchase made via the In-app Billing Sandbox, orderId property will be empty.

Attention! devtodev server does not process transactions with previously used transaction IDs. Also the server validates the identifiers in appearance, to avoid evident cheat transactions. To avoid the entering of cheat payments in reports completely, use devtodev anticheat service before creating realPayment event.

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.

/**
* In-app purchase with a definite article ID.
* @param purchaseId - unique purchase Id or name (max. 32 symbols)
* @param purchaseType - purchase type or group (max. 96 symbols)
* @param purchaseAmount - count of purchased goods
* @param purchasePrice - cost of purchased goods (total cost - if several goods were purchased)
* @param purchaseCurrency - currency name (max. 24 symbols)
*/
DevToDev.inAppPurchase(purchaseId:String, purchaseType:String, purchaseAmount:int, purchasePrice:int,
                       purchaseCurrency:String);

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.

var resources: Dictionary = new Dictionary();
resources["currency_1"] = 120;
resources["currency_2"] = 29;
//...and so on...

DevToDev.inAppPurchaseWithResources(purchaseId:String, purchaseType:String, purchaseAmount:int,
                                    resources:Dictionary);

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. 

/**
* Simple custom event
* @param String eventName - event name
*/
DevToDev.customEvent(eventName:String);

10 parameter names may be associated with any event:

var params:CustomEventParams = new CustomEventParams();
/**
* String type custom event parameter
* @param paramName - parameter name
* @param value - parameter value
*/
params.putString(paramName:String , value:String);
//Integer type custom event parameter
params.putInt(paramName:String, 145:int);
//Number type custom event parameter
params.putFloat(paramName:String, 9.99:Number);

Then use method:

/**
* Custom event with params
* @param eventName - event name
* @param params - event parameters
*/
DevToDev.customEventsWithParams(eventName:String, params:CustomEventParams);

Progression event

First of all, the event is used for the games with short (within one game session) locations, game levels. The event allows you to gather data on passing the locations and get statistics on parameters which vary during the the location passing.

Developer must use these 2 methods:

  1. Method StartProgressionEvent when enetring the location
    /**
    * The method have to be used when entering the location.
    * @param locationName - the name of location user entered.
    * @param params - instance of location parameters class
    */
    DevToDev.StartProgressionEvent(locationName:String, params:LocationEventParams);

     

  2. Method EndProgressionEvent when exiting (no matter if completed or not)  the location
    /**
    * The method have to be used when the location passing is over.
    * @param locationName - the name of location user left.
    * @param params - instance of location parameters class
    */
    DevToDev.EndProgressionEvent(locationName:String, params:LocationEventParams);

    LocationEventParams class methods:

    /**
    * Location level of difficulty (optional).
    * @param difficultyLevel - level of difficulty
    */
    SetDifficulty(difficultyLevel:int);
    
    /**
    * Previously visited location (optional).
    * @param locationName -  previously visited location name
    */
    SetSource(locationName:String);
    
    /**
    * State/result of the location passing (required).
    * @param isCompleted -  true if location is successfuly passed
    */
    SetSuccessfulCompletion(isCompleted:Boolean);
    
    /**
    * Time spent in the location (optional).
    * In case the parameter is not specified by the developer, it will be automatically calculated
    * as the date difference between StartProgressionEvent and EndProgressionEvent method calls.
    * @param duration - time in seconds
    */
    SetDuration(duration:int);
    
    /**
    * User spendings within the location passing (optional).
    * @ param spent - user spendings. Key max.length is 24 symbols.
    */
    SetSpent(spent:Dictionary);
    
    /**
    * User earnings within the location passing (optional).
    * @param earned - user earnings. Key max.length is 24 symbols.
    */
    SetEarned(earned:Dictionary);

     

Attention! The user can be only in one location at the same time. When moving to another location (including embedded), the previous location must be completed. Information on locations, the passing of which was not completed by calling EndProgressionEvent method during the game session (the call of EndProgressionEvent method is not integrated; user unloaded the application from the device memory; there was an application crash) do not fall in the statistics.

Let’s analyse the example of event integration on match3 game with location map:

// Player comes to the third location on the map “Village” while following the game map. 
// Create a parameters object
var params:LocationEventParams = new LocationEventParams();

// Specify the known location parameters:
// Passing on the first level of difficulty.
params.SetDifficulty(1);

// Before entering this location gamer passed the third location on the map “Village” (optional).
params.SetSource("Vilage step 02");

//The location passing starts (required).
DevToDev.StartProgressionEvent("Vilage step 03", params);

// ... Player passing the location.

// Player finishes passing of the third location on the map “Village”
var params:LocationEventParams = new LocationEventParams();

// The location is passed successfully (required).
params.SetSuccessfulCompletion(true);

// The passing took 189 seconds.
params.SetDuration(189);

// Location is passed for 54 turns. While the passing gamer used boost and bought extra 5 turns.
var spent:Dictionary = new Dictionary();
spent["Turns"] = 54;
spent["Boost Bomb"] = 1;
spent["Extra 5 Turns"] = 1;
params.SetSpent(spent);

// Gamer finished the passing with 3 stars and gained 5 coins and 1200 score.
var earned:Dictionary = new Dictionary();
earned["Stars"] = 3;
earned["Score"] = 1200;
earned["Coins"] = 5;
params.SetEarned(earned); 

// The location passing is over (required).
DevToDev.EndProgressionEvent("Vilage step 03", params);

 

Analytics Integration
User profile