Follow

Using the inApPurchase function to track individual user revenues

The following article explains the steps necessary to implement the custom event, "Apmetrix.InApPurchase" function as well as the syntax you will need to successfully implement the tracking of all your in-game purchase events. 

It's important to note that this function should only be used when dealing with tracking an in-app currency purchase dealing with REAL WORLD MONEY when purchased from any app store where your app is downloaded from. 

The platform allows you to track individual purchases from your users by sending in the transactional data which we then convert to your preferred local currency, thereby allowing you to track the lifetime value of individual users. 

“In App Purchase Events” are specific events related to users who purchases in app currency or other items with real money such as gold or gem packs etc.  It’s important to note that although you can download your revenues from iTunes (which we also allow you to do) it only aggregates the data by the number of the transactions and in different currencies with no way of tracking the transaction back to the individual user.  Using the Apmetrix.InAppPurchase function provides greater insights into direct user lifetime value specially when combined with other correlated data such as demographic, app progression, social media sources., and is therefore highly recommended for those publishers that want to track lifetime value of their users.

By now you should be familiar with what we refer to in our platform as “datasets” when creating a new report, or when adding data to an existing report.  

Each section contains a small question/answer so you can map your function usage correctly. Make sure you are following the specific SDK Syntax.

Question: How would I track a micro-transaction using a local currency and converting all currency to a defined currency.

Answer: You can use the InApPurchase function by passing the User's local currency and setting a currency to convert to as shown below.

Unity:

 Call the following method in the ApmetrixWrapper GameObject to track the In-App Purchase  (Micro Transaction) events:

apmetrixObj.InApPurchase(int qty, string type, string location, float localCost, (OPTIONAL)string localCurrency, (OPTIONAL)string convertedCurrency);

 

UNITY EXAMPLE:

apmetrixObj.InApPurchase(1, "100 Gem Package", "Cash Shop", 5.00f, ApmetrixStatic.ARS, ApmetrixStatic.USD);

  

Android:

Apmetrix.inApPurchase(int quantity, String item, String location, double itemCost, String localCurrency,            String convertedCurrency);

 

Android Example: 

Apmetrix.inApPurchase(1, "100 Rare Gem Package", "Main Screen, 2.25, Apmetrix.EUR, Apmetrix.USD);

 

IOS:

As per Apple's guidelines listed at the following link 

We required that you use the SKProduct.priceLocale to get the Country Code. Once you have the SKProduct.priceLocale value you can obtain the Country Code using the following code.

IOS Example:

NSString *countryCode = [SKProduct.priceLocale objectForKey:NSLocaleCountryCode];
[Apmetrix inApPurchase:25 andItem:@“gems” andLocation:@“Main Screen” andItemCost:2.25
andLocalCurrency:countryCode andConvertedCurrency:CURRENCY_USD];

 

Question: How would I track a micro-transaction without knowing the user's local currency?

Answer: You can pass a zero string for the user's local currency as shown below. The Apmetrix server will then do a currency look-up based on the user's IP.

Unknown Local Currency:

Use this when you do not know the country code for the local currency. We will do a server side look-up based on your current country to do the conversion.

Unity:

apmetrixObj.InApPurchase(1, "100 Rare Gem Package", "The Store", 10.0f, "0", ApmetrixStatic.USD);

 

Android: 

Apmetrix.inApPurchase(1, "100 Rare Gem Package", "Main Screen, 2.25, "0", Apmetrix.USD);

 

Question: How would I track a micro-transaction without knowing the user's local currency or knowing which currency I want to convert to?

Answer: You can omit the local and converted currency types as shown below. In this case the Apmetrix Server will handle to look-ups for local currency and use the currency that is defined in your App's settings via the Apmetrix Dashboard.

Unknown Converted Currency:

Use this when you do not know the country code for the converted currency. We will convert the currency to the type that is stated in the Application on the Apmetrix Dashboard

Unity:

apmetrixObj.InApPurchase(1, "100 Rare Gem Package", "The Store", 10.0f);

 

Android: 

Apmetrix.inApPurchase(1, "100 Rare Gem Package", "Main Screen, 2.25);

 

Currency List:

       "AED": "United Arab Emirates Dirham",

        "AFN": "Afghan Afghani",

        "ALL": "Albanian Lek",

        "AMD": "Armenian Dram",

        "ANG": "Netherlands Antillean Guilder",

        "AOA": "Angolan Kwanza",

        "ARS": "Argentine Peso",

        "AUD": "Australian Dollar",

        "AWG": "Aruban Florin",

        "AZN": "Azerbaijani Manat",

        "BAM": "Bosnia-Herzegovina Convertible Mark",

        "BBD": "Barbadian Dollar",

        "BDT": "Bangladeshi Taka",

        "BGN": "Bulgarian Lev",

        "BHD": "Bahraini Dinar",

        "BIF": "Burundian Franc",

        "BMD": "Bermudan Dollar",

        "BND": "Brunei Dollar",

        "BOB": "Bolivian Boliviano",

        "BRL": "Brazilian Real",

        "BSD": "Bahamian Dollar",

        "BTC": "Bitcoin",

        "BTN": "Bhutanese Ngultrum",

        "BWP": "Botswanan Pula",

        "BYR": "Belarusian Ruble",

        "BZD": "Belize Dollar",

        "CAD": "Canadian Dollar",

        "CDF": "Congolese Franc",

        "CHF": "Swiss Franc",

        "CLF": "Chilean Unit of Account (UF)",

        "CLP": "Chilean Peso",

        "CNY": "Chinese Yuan",

        "COP": "Colombian Peso",

        "CRC": "Costa Rican Colón",

        "CUP": "Cuban Peso",

        "CVE": "Cape Verdean Escudo",

        "CZK": "Czech Republic Koruna",

        "DJF": "Djiboutian Franc",

        "DKK": "Danish Krone",

        "DOP": "Dominican Peso",

        "DZD": "Algerian Dinar",

        "EEK": "Estonian Kroon",

        "EGP": "Egyptian Pound",

        "ETB": "Ethiopian Birr",

        "EUR": "Euro",

        "FJD": "Fijian Dollar",

        "FKP": "Falkland Islands Pound",

        "GBP": "British Pound Sterling",

        "GEL": "Georgian Lari",

        "GHS": "Ghanaian Cedi",

        "GIP": "Gibraltar Pound",

        "GMD": "Gambian Dalasi",

        "GNF": "Guinean Franc",

        "GTQ": "Guatemalan Quetzal",

        "GYD": "Guyanaese Dollar",

        "HKD": "Hong Kong Dollar",

        "HNL": "Honduran Lempira",

        "HRK": "Croatian Kuna",

        "HTG": "Haitian Gourde",

        "HUF": "Hungarian Forint",

        "IDR": "Indonesian Rupiah",

        "ILS": "Israeli New Sheqel",

        "INR": "Indian Rupee",

        "IQD": "Iraqi Dinar",

        "IRR": "Iranian Rial",

        "ISK": "Icelandic Króna",

        "JEP": "Jersey Pound",

        "JMD": "Jamaican Dollar",

        "JOD": "Jordanian Dinar",

        "JPY": "Japanese Yen",

        "KES": "Kenyan Shilling",

        "KGS": "KyrgystaniSom",

        "KHR": "Cambodian Riel",

        "KMF": "Comorian Franc",

        "KPW": "North Korean Won",

        "KRW": "South Korean Won",

        "KWD": "Kuwaiti Dinar",

        "KYD": "Cayman Islands Dollar",

        "KZT": "Kazakhstani Tenge",

        "LAK": "Laotian Kip",

        "LBP": "Lebanese Pound",

        "LKR": "Sri Lankan Rupee",

        "LRD": "Liberian Dollar",

        "LSL": "Lesotho Loti",

        "LTL": "Lithuanian Litas",

        "LVL": "Latvian Lats",

        "LYD": "Libyan Dinar",

        "MAD": "Moroccan Dirham",

        "MDL": "Moldovan Leu",

        "MGA": "Malagasy Ariary",

        "MKD": "Macedonian Denar",

        "MMK": "Myanma Kyat",

        "MNT": "Mongolian Tugrik",

        "MOP": "Macanese Pataca",

        "MRO": "Mauritanian Ouguiya",

        "MTL": "Maltese Lira",

        "MUR": "Mauritian Rupee",

        "MVR": "Maldivian Rufiyaa",

        "MWK": "Malawian Kwacha",

        "MXN": "Mexican Peso",

        "MYR": "Malaysian Ringgit",

        "MZN": "Mozambican Metical",

        "NAD": "Namibian Dollar",

        "NGN": "Nigerian Naira",

        "NIO": "Nicaraguan Córdoba",

        "NOK": "Norwegian Krone",

        "NPR": "Nepalese Rupee",

        "NZD": "New Zealand Dollar",

        "OMR": "Omani Rial",

        "PAB": "Panamanian Balboa",

        "PEN": "Peruvian Nuevo Sol",

        "PGK": "Papua New Guinean Kina",

        "PHP": "Philippine Peso",

        "PKR": "Pakistani Rupee",

        "PLN": "Polish Zloty",

        "PYG": "Paraguayan Guarani",

        "QAR": "Qatari Rial",

        "RON": "Romanian Leu",

        "RSD": "Serbian Dinar",

        "RUB": "Russian Ruble",

        "RWF": "Rwandan Franc",

        "SAR": "Saudi Riyal",

        "SBD": "Solomon Islands Dollar",

        "SCR": "Seychellois Rupee",

        "SDG": "Sudanese Pound",

        "SEK": "Swedish Krona",

        "SGD": "Singapore Dollar",

        "SHP": "Saint Helena Pound",

        "SLL": "Sierra Leonean Leone",

        "SOS": "Somali Shilling",

        "SRD": "Surinamese Dollar",

        "STD": "São Tomé and Príncipe Dobra",

        "SVC": "Salvadoran Colón",

        "SYP": "Syrian Pound",

        "SZL": "Swazi Lilangeni",

        "THB": "Thai Baht",

        "TJS": "Tajikistani Somoni",

        "TMT": "TurkmenistaniManat",

        "TND": "Tunisian Dinar",

        "TOP": "Tongan Paʻanga",

        "TRY": "Turkish Lira",

        "TTD": "Trinidad and Tobago Dollar",

        "TWD": "New Taiwan Dollar",

        "TZS": "Tanzanian Shilling",

        "UAH": "Ukrainian Hryvnia",

        "UGX": "Ugandan Shilling",

        "USD": "United States Dollar",

        "UYU": "Uruguayan Peso",

        "UZS": "Uzbekistan Som",

        "VEF": "Venezuelan Bolívar Fuerte",

        "VND": "Vietnamese Dong",

        "VUV": "Vanuatu Vatu",

        "WST": "Samoan Tala",

        "XAF": "CFA Franc BEAC",

        "XAG": "Silver (troy ounce)",

        "XAU": "Gold (troy ounce)",

        "XCD": "East Caribbean Dollar",

        "XDR": "Special Drawing Rights",

        "XOF": "CFA Franc BCEAO",

        "XPF": "CFP Franc",

        "YER": "Yemeni Rial",

        "ZAR": "South African Rand",

        "ZMK": "Zambian Kwacha (pre-2013)",

        "ZMW": "Zambian Kwacha",

        "ZWL": "Zimbabwean Dollar"

 

 

Have more questions? Submit a request