Skip to content

Purchase Tracking

Track in-app purchases to see revenue data, top products, and ARPPU (Average Revenue Per Paying User) in the dashboard.

QuestData.track_purchase(product_id: String, price: float, currency: String = "USD", metadata: Dictionary = {})
ParameterTypeDefaultDescription
product_idStringrequiredStore product identifier (e.g. "starter_pack", "coins_500")
pricefloatrequiredPurchase price (must be > 0)
currencyString"USD"ISO 4217 currency code (auto-uppercased)
metadataDictionary{}Additional data (merged into event properties)

Sends a purchase_completed event. The SDK validates that product_id is not empty and price is positive.

# Basic purchase
func _on_purchase_confirmed(product: StoreProduct):
QuestData.track_purchase(product.id, product.price, product.currency)
# Purchase with metadata
func _on_iap_completed(product_id: String, receipt: Dictionary):
QuestData.track_purchase(product_id, 4.99, "USD", {
"store": "google_play",
"transaction_id": receipt.get("transaction_id", ""),
"first_purchase": not has_purchased_before
})
# Virtual currency purchase
func _on_coins_bought():
QuestData.track_purchase("coins_1000", 2.99, "EUR", {
"coins_received": 1000,
"bonus_coins": 100
})
# Battle Pass purchase
func _on_battle_pass_purchased():
QuestData.track_purchase("battle_pass_s3", 9.99, "USD", {
"season": 3,
"duration_days": 30,
"type": "subscription"
})

View purchase data under Monetization > Revenue:

  • Revenue Timeline — Daily/weekly/monthly revenue charts
  • Top Products — Best-selling items ranked by revenue
  • ARPPU — Average Revenue Per Paying User
  • Purchase Count — Number of transactions over time
  1. track_purchase() creates a purchase_completed event
  2. The price and currency are stored as event properties
  3. Any metadata keys are merged into the same properties dictionary
  4. The event is queued and batched like any other event
  5. The backend aggregates revenue data for dashboard display
  1. Track after confirmation — Only call track_purchase() after the purchase is verified by your store
  2. Use consistent product IDs — Match your store’s product identifiers exactly
  3. Include currency — Different markets use different currencies; always specify
  4. Add store metadata — Transaction IDs help reconcile with store dashboards
  5. Track refunds separately — Use a custom event like QuestData.track("purchase_refunded", {...})