Record events
You can associate your Adjust event tokens to actions in your app to measure them. To measure an event:
- Create a new Adjust event instance and pass your event token as a string argument.
- Call the
trackEvent
method with your event instance as an argument.
Record event revenue
You can measure revenue associated with an event by setting the revenue
and currency
properties on your event instance. Use this feature to measure revenue-generating actions in your app.
To set these properties, call the setRevenue
method and pass the following arguments:
- The
revenue
amount (number) - The
currency
code (string)
You must format the currency code as a 3 character string that follows the ISO 4217 standard. The Adjust backend converts the reported revenue to your chosen reporting currency. Check our guide to tracking purchases in different currencies for more information.
trackEvent
only after the purchase is complete.
Purchase verification
Purchase verification is an optional feature. These settings have no effect unless purchase verification is enabled.
If you've enabled purchase verification, you must send additional information with your purchase events to verify them. When Adjust's servers receive this information in an event object, they forward it to Apple to verify the purchase.
transactionId
(NSString)- The
transactionIdentifier
value of the successfully completed purchase productId
(NSString)- The product identifier of the item that was successfully purchased
receipt
(NSData)- The signed receipt containing the information about the successfully completed purchase
Deduplicate revenue events
- (void)setTransactionId:(nonnull NSString *)transactionId;
You can pass an optional identifier to avoid recording duplicate events. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs.
To set the identifier, assign your transaction ID to the setTransactionId
property of your event instance.
Example
This example shows how to record an event with the token g3mfiw
whenever a user interacts with a button. The function sets the uniqueId
to 5e85484b-1ebc-4141-aab7-25b869e54c49
using the setTransactionId
method.
Add callback parameters
If you register a callback URL for your events in the Adjust dashboard, Adjust sends a GET request to your callback URL when the SDK measures an event.
You can configure callback parameters to your servers. Once you configure parameters on an event, the SDK appends them to your callback URL. You can use this information to analyse your users' in-app behavior with your BI system.
Add callback parameters to your event by calling the addCallbackParameter
method with string key-value arguments. You can add multiple parameters by calling this method multiple times.
The Adjust SDK measures the event and sends a request to your URL with the callback parameters. For example, if you register the URL http://www.mydomain.com/callback
, your callback looks like this:
http://www.mydomain.com/callback?key=value&foo=bar
If you are using CSV uploads, make sure to add the parameters to your CSV definition.
Adjust supports many placeholders which you can use to pass information from the SDK to your URL. For example, the {idfa}
placeholder for iOS and the {gps_adid}
placeholder for Android. The {publisher_parameter}
placeholder presents all callback parameters in a single string.
You can read more about using URL callbacks, including a full list of available values, in our callbacks guide.
Add partner parameters
You can send extra information to your network partners by adding partner parameters.
Adjust sends partner parameters to external partners you have set up. This information is useful for more granular analysis and retargeting purposes. The backend forwards these parameters once you have set them up and enabled them for a partner.
{partner_parameters}
placeholder to receive them as a single string.
Add partner parameters to your event by calling the addPartnerParameter
method with string key-value arguments. You can add multiple parameters by calling this method multiple times.
Add a callback identifier
You can add a custom string identifier to each event you want to measure. The Adjust backend can report on this identifier in event callbacks. This enables you to keep track of which events have been successfully measured.
Set up this identifier by calling the setCallbackId
method with your ID as a string argument.