We constantly publish updates to our documentation, which may not yet be available in your language. For the most current information, use the English version.
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:
let event = ADJEvent(eventToken: "abc123")
event?.setRevenue(0.01, currency: "EUR")
Adjust.trackEvent(event)
Tip:
If you are measuring in-app purchases, call trackEvent only after the purchase is complete.
Example
In this example, we measure an event with the token g3mfiw whenever a user interacts with a button. We set the revenue property of this event to 0.25 and the currency property to EUR.
Swift
Objective-C
Javascript
import Adjust
import UIKit
class ViewControllerSwift: UIViewController {
@IBOutlet weak var btnRecordEventRevenue: UIButton?
@IBAction func btnRecordEventRevenue(_sender: UIButton) {
let event = ADJEvent(eventToken: "g3mfiw");
event?.setRevenue(0.25, currency: "EUR");
Adjust.trackEvent(event);
}
}
You can pass an optional identifier to avoid measuring duplicate events. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs.
To set the identifier, call the setTransactionId method and pass your transaction ID as a string argument.
Swift
Objective-C
Javascript
let event = ADJEvent(eventToken: "abc123")
event?.setTransactionId(eventIdentifier)
Adjust.trackEvent(event)
Example
In this example, we measure an event with the token g3mfiw whenever a user interacts with a button. We create a string variable called uniqueId with the value 5e85484b-1ebc-4141-aab7-25b869e54c49. We then pass this value to the setTransactionId method to set the transactionId property.
Swift
Objective-C
Javascript
import Adjust
import UIKit
class ViewControllerSwift: UIViewController {
@IBOutlet weak var btnRecordEventUnique: UIButton?
@IBAction func btnRecordEventUnique(_sender: UIButton) {
let event = ADJEvent(eventToken: "g3mfiw");
let uniqueId = "5e85484b-1ebc-4141-aab7-25b869e54c49";
event?.setTransactionId(uniqueId);
Adjust.trackEvent(event);
}
}
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:
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.
Note:
Adjust does not store your custom callback parameters. Custom parameters are only appended to your callback URL.
Example
In this example, we measure an event with the token g3mfiw whenever a user interacts with a button. We add the following callback 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.
Note:
Partner parameters do not appear in raw data by default. You can add the {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.
In this example, we measure an event with the token g3mfiw whenever a user interacts with a button. We add the following information as partner parameters:
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.
Swift
Objective-C
Javascript
let event = ADJEvent(eventToken: "abc123")
event?.setCallbackId("Your-Custom-ID")
Adjust.trackEvent(event)
Example
In this example, we measure an event with the token g3mfiw whenever a user interacts with a button. We create a string variable called callbackId with the value f2e728d8-271b-49ab-80ea-27830a215147. We then pass this value to the setCallbackId method to set the callbackId property.
Swift
Objective-C
Javascript
import Adjust
import UIKit
class ViewControllerSwift: UIViewController {
@IBOutlet weak var btnRecordEventCallbackId: UIButton?
@IBAction func btnRecordEventCallbackId(_sender: UIButton) {
let event = ADJEvent(eventToken: "g3mfiw");
event?.setCallbackId("f2e728d8-271b-49ab-80ea-27830a215147")
Adjust.trackEvent(event);
}
}