The Adjust SDK provides an ADJEvent object which can be used to structure and send event information from your app to Adjust’s servers.
Instantiate an ADJEvent object
To send event information with the Adjust SDK, you need to instantiate an ADJEvent object. This object contains variables that are sent to Adjust when an event occurs in your app.
To instantiate an event object, create a new ADJEvent instance and pass the following parameters:
You can record revenue associated with an event by setting the revenue and currency properties on your event instance. Use this feature to record revenue-generating actions in your app.
To set these properties, call the setRevenue method and pass the following arguments:
revenue (double): The amount of revenue generated by the event
currency (NSString): The ISO 4217 code of the event currency.
This example shows how to record an event with the token g3mfiw whenever a user interacts with a button. The function sets the revenue property of this event to 0.25 and the currency property to EUR.
You can pass an optional deduplication identifier to avoid recording duplicate events. To set the identifier, assign your transaction ID to the setDeduplicationId property of your event instance. If the same event is sent multiple times, Adjust disregards the duplicated event information.
You can set a custom limit on the number of deduplicationId that can be added to the list for identifying duplicate events. By default, the limit is set to 10.
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.
If you register a callback URL in the Adjust dashboard, the SDK sends a GET request to your callback URL when it records an event.
You can configure callback parameters to send to your servers. Once you configure parameters on an event, the SDK appends them to your callback URL. You can use this information to analyze your users’ in-app behavior with your BI system.
Add callback parameters to your event by calling the addCallbackParameter method with NSString 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 https://www.mydomain.com/callback, your callback looks like this:
If you’re 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.
Example
This example shows how to record an event with the token g3mfiw whenever a user interacts with a button. The following callback parameters are added:
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. Adjust’s servers forward these parameters once you have set them up and enabled them for a partner.
Add partner parameters to your event by calling the addPartnerParameter method with NSString key-value arguments. You can add multiple parameters by calling this method multiple times.
You can add a custom string identifier to each event you want to measure. Adjust’s servers 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 an NSString argument.
This example shows how to record an event with the token g3mfiw whenever a user interacts with a button. In this example, the callbackId is set to f2e728d8-271b-49ab-80ea-27830a215147.