Event tracking

You can use the Adjust SDK to track event information by associating an event with an event token. To do this, you will need to create event tokens for each event you want to track in the Adjust dashboard.

For example, if you wanted to track every tap on a button in your app, you would start by setting up an event token. You would then call on the trackEvent method with your event token every time the user taps the button.

Java
Javascript
AdjustEvent adjustEvent = new AdjustEvent("abc123");
Adjust.trackEvent(adjustEvent);

If you have logging enabled, you should see a message indicating that the SDK has logged the event.

Revenue tracking

You can use event tracking to track revenue-generating actions in your app. This includes ad engagements and in-app purchases. For example, if each tap is worth one Euro cent you could use the following to track the revenue event:

Java
Javascript
AdjustEvent adjustEvent = new AdjustEvent("abc123");
adjustEvent.setRevenue(0.01, "EUR");
Adjust.trackEvent(adjustEvent);

The currency token should be a three character string that follows the ISO 4217 standard. The Adjust backend will then convert the revenue into your chosen reporting currency. Check our guide to tracking purchases in different currencies for more information.

Purchase verification

Note:

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 Google to verify the purchase.

productId (String)
The product identifier of the item that was successfully purchased
purchaseToken (String)
The purchase token generated for your successfully completed in-app purchase
Kotlin
Java
val adjustEvent = AdjustEvent("abc123")
adjustEvent.setRevenue(6.0, "EUR");
adjustEvent.setProductId("product-id");
adjustEvent.setPurchaseToken("purchase-token");
Adjust.trackEvent(adjustEvent);

Revenue deduplication

public void setOrderId(String orderId)

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, call the setOrderId method and pass your transaction ID as a String argument.

Kotlin
Java
Javascript
val adjustEvent = AdjustEvent("abc123")
adjustEvent.setRevenue(0.01, "EUR")
adjustEvent.setOrderId("{OrderId}")
Adjust.trackEvent(adjustEvent)

Example

This example shows how to record an event with the token g3mfiw whenever a user interacts with a button. The function sets the orderId to 5e85484b-1ebc-4141-aab7-25b869e54c49 using the setOrderId method.

Kotlin
Java
Javascript
fun onTrackUniqueEventClick(v: View) {
   val event = AdjustEvent("g3mfiw")
   event.setOrderId("5e85484b-1ebc-4141-aab7-25b869e54c49")
   Adjust.trackEvent(event)
}

Callback parameters

You can register a callback URL for your events in the Adjust dashboard. The Adjust backend will send a GET request to that URL whenever the SDK tracks an event. You can add callback parameters to that event by calling the addCallbackParameter method on the event before tracking it. The Adjust backend will then append these parameters to your callback URL.

The SDK sends callback parameters to your servers. Once you configure parameters on an event, the SDK will append them to your callback URL. You can use this information to analyse your users' in-app behavior with your BI system.

For example, if you have registered the URL http://www.mydomain.com/callback, you can track an event like this:

Java
Javascript
AdjustEvent adjustEvent = new AdjustEvent("abc123");
adjustEvent.addCallbackParameter("key", "value");
adjustEvent.addCallbackParameter("foo", "bar");
Adjust.trackEvent(adjustEvent);

The Adjust SDK would track the event and send a request to your URL with the callback parameters.

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, you can pass the device's Advertising ID using the {gps_adid} placeholder. The {publisher_parameter} placeholder presents all callback parameters in a single string.

Note:
Adjust does not store your custom callback parameters. Custom parameters are only appended to your callback URL.

You can read more about using URL callbacks, including a full list of available values, in our callbacks guide.

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 will forward these parameters once you have set them up and enabled them for a partner.

For example, you can pass product_id information with purchase events, or user_id with login events. Unlike callback parameters, partner parameters will not appear in raw data by default. You can add the {partner_parameters} placeholder to receive them as a single string.

Partner parameters work in a similar way to callback parameters. You can add them by calling the addPartnerParameter method on your event.

Java
Javascript
AdjustEvent adjustEvent = new AdjustEvent("abc123");
adjustEvent.addPartnerParameter("key", "value");
adjustEvent.addPartnerParameter("foo", "bar");
Adjust.trackEvent(adjustEvent);

Callback identifier

You can add a custom string identifier to each event you want to track. The Adjust backend can report on this identifier in event callbacks. This enables you to keep track of which events have been successfully tracked. You can set up this identifier by calling the setCallbackId method on your event.

Java
Javascript
AdjustEvent adjustEvent = new AdjustEvent("abc123");
adjustEvent.setCallbackId("Your-Custom-Id");
Adjust.trackEvent(adjustEvent);