Purchase Events¶
GetSocial SDK supports tracking purchases users make in your application. The gathered data is shown in Revenue Analytics section.
Automatic tracking¶
In order to automatically track purchases, follow the setup guide here.
Manual tracking¶
If you don’t want to use automated tracking, you can report purchase events on your own.
val purchaseData = new PurchaseData()
.withProductId(product_id)
.withProductTitle(product_title)
.withProductType(product_type) // Item or subscription
.withPrice(product_price)
.withPriceCurrency(price_currency)
.withPurchaseId(purchase_id)
.withPurchaseDate(purchase_date)
Analytics.trackPurchaseEvent(purchaseData)
var purchaseData = PurchaseData()
purchaseData.productId = // product id
purchaseData.productType = ProductType.Item.rawValue // item or subscription
purchaseData.productTitle = // product title
purchaseData.price = // product price
purchaseData.priceCurrency = // price currency
purchaseData.purchaseDate = // purchase date
purchaseData.transactionIdentifier = // unique transaction id
Analytics.trackPurchase(purchaseData)
var purchaseData = new PurchaseData();
purchaseData.ProductId = // product id
purchaseData.PurchaseType = // item or subscription
purchaseData.ProductTitle = // product title
purchaseData.Price = // product price
purchaseData.PriceCurrency = // price currency
purchaseData.PurchaseDate = // purchase date
purchaseData.PurchaseId = // unique transaction id
Analytics.TrackPurchase(purchaseData);
PurchaseData purchaseData = PurchaseData(
'id', // product id,
type, // item or subscription,
'title', // product title,
price, // product price,
currency, // price currency
date, // purchase date
purchaseId // unique transaction id
);
Analytics.trackPurchaseEvent(purchaseData);
const purchaseData = new PurchaseData({
productId: 'id', // product id,
productType: 'type', // item or subscription,
productTitle: 'title', // product title,
price: 2.99, // product price,
priceCurrency: 'EUR', // price currency
purchaseDate: date, // purchase date in UNIX timestamp
transactionIdentifier: purchaseId // unique transaction id
});
Analytics.trackPurchase(purchaseData);
const purchaseData = new GetSocialSDK.PurchaseData({
product_id: 'id', // product id,
product_type: 'type', // item or subscription,
product_title: 'title', // product title,
price: 2.99, // product price,
price_currency: 'EUR', // price currency
purchase_date: new Date(), // purchase date in ISO 8601 format
transaction_identifier: 'purchaseId' // unique transaction id
});
GetSocialSDK.Analytics.trackPurchase(purchaseData);