Track Purchase Event
To track a purchase event in Unity, you will use the TrackPurchaseEvent
function. The following example demonstrates how to track a purchase event from a Unity script.
Method Signature:
Explanation:
Calling the
TrackPurchaseEvent
Method:The
TrackPurchaseEvent
method is called on theactivity
object with the order ID"order123"
, purchase amount49.99
, currency"USD"
, and no additional parameters (null
).
Adding Parameters
If you need to pass additional parameters to the TrackPurchaseEvent
function, you can modify the call to include a dictionary of parameters.
Modified Example Script:
Explanation:
Dictionary Creation:
A dictionary of parameters is created with key-value pairs.
Calling
TrackPurchaseEvent
with Parameters:The
TrackPurchaseEvent
method is called with the order ID, purchase amount, currency, and the dictionary of parameters.
Last updated