adjust-icon

Send event information

The Adjust SDK provides an AdjustEvent object which can be used to structure and send event information from your app to Adjust’s servers.

Instantiate an AdjustEvent object

Method signature
AdjustEvent(String eventToken)

To send event information with the Adjust SDK, you need to instantiate an AdjustEvent 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 AdjustEvent instance and pass the following parameters:

AdjustEvent myAdjustEvent = new AdjustEvent('abc123');
//...
Adjust.trackEvent(myAdjustEvent);

Send an event

Method signature
static void trackEvent(AdjustEvent event)
Event log
Path: /event
ClientSdk: flutter$FLUTTER_VERSION
Parameters:
android_uuid 781f17d5-5048-4fae-a4e5-77b58bab62b9
api_level 34
41 collapsed lines
app_token 2fm9gkqubvpc
app_version 1.0
attribution_deeplink 1
callback_params {"key":"value","foo":"bar"}
connectivity_type 1
country US
cpu_type arm64-v8a
created_at 2024-01-25T14:13:16.151Z+0100
currency EUR
device_manufacturer Google
device_name sdk_gphone64_arm64
device_type phone
display_height 2205
display_width 1080
environment sandbox
event_buffering_enabled 0
event_count 3
event_token abc123
gps_adid 5962dfc1-3a53-4692-850b-22c4bf4311a5
gps_adid_attempt 2
gps_adid_src service
hardware_name UE1A.230829.036
language en
mcc 310
mnc 260
needs_response_details 1
os_build UE1A.230829.036
os_name android
os_version 14
package_name com.adjust.examples
partner_params {"key":"value","foo":"bar"}
revenue 0.25
screen_density high
screen_format long
screen_size normal
session_count 2
session_length 23
subsession_count 1
time_spent 23
tracking_enabled 1
ui_mode 1

Record event revenue

Method signature
void setRevenue(num revenue, String currency)

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 (num): The amount of revenue generated by the event
  • currency (String): The ISO 4217 code of the event currency.
AdjustEvent myAdjustEvent = new AdjustEvent('abc123');
//...
adjustEvent.setRevenue(0.01, 'EUR');
//...
Adjust.trackEvent(myAdjustEvent);
Event log
Path: /event
ClientSdk: flutter$FLUTTER_VERSION
Parameters:
environment sandbox
event_count 3
event_token abc123
revenue 0.01
currency EUR

Deduplicate revenue events

Property declaration
String? deduplicationId;

You can pass an optional identifier to avoid recording duplicate events. By default, the SDK stores the last 10 identifiers and skips revenue events with duplicate transaction IDs. In case you would like the SDK to store more than 10 identifiers, you can set the desired number of identifiers by assigning the value to eventDeduplicationIdsMaxSize of the AdjustConfig instance.

To set the identifier, assign your deduplcation ID to the deduplicationId property of your event instance.

adjustConfig.eventDeduplicationIdsMaxSize = 20;
Adjust.initSdk(config);
// ...
AdjustEvent myAdjustEvent = new AdjustEvent('abc123');
myAdjustEvent.deduplicationId = 'deduplication-id';
Adjust.trackEvent(myAdjustEvent);
Event log
Path: /event
ClientSdk: flutter$FLUTTER_VERSION
Parameters:
environment sandbox
event_count 3
event_token abc123
deduplication_id deduplication-id

Add callback parameters

Method signature
void addCallbackParameter(String key, String value)

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 String key-value arguments. You can add multiple parameters by calling this method multiple times.

AdjustEvent myAdjustEvent = new AdjustEvent('abc123');
adjustEvent.addCallbackParameter('key', 'value');
Adjust.trackEvent(myAdjustEvent);
Event log
Path: /event
ClientSdk: flutter$FLUTTER_VERSION
Parameters:
callback_params {"key":"value"}
environment sandbox
event_count 1
event_token abc123

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:

https://www.mydomain.com/callback?key=value&foo=bar

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.

Add partner parameters

Method signature
void addPartnerParameter(String key, String value)

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 String key-value arguments. You can add multiple parameters by calling this method multiple times.

AdjustEvent myAdjustEvent = new AdjustEvent('abc123');
adjustEvent.addPartnerParameter('key', 'value');
Adjust.trackEvent(myAdjustEvent);
Event log
Path: /event
ClientSdk: flutter$FLUTTER_VERSION
Parameters:
partner_params {"key":"value"}
environment sandbox
event_count 1
event_token abc123

Add a callback identifier

Property declaration
String? callbackId;

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 assigning your ID to the callbackId property on your event instance.

AdjustEvent myAdjustEvent = new AdjustEvent('abc123');
myAdjustEvent.callbackId = 'your-callback-id';
Adjust.trackEvent(myAdjustEvent);
Event log
Path: /event
ClientSdk: flutter$FLUTTER_VERSION
Parameters:
environment sandbox
event_count 3
event_token abc123
callback_id your-callback-id