You can use the Adjust SDK to send event information to Adjust's servers in response to actions taken by your users. Adjust records these events and surfaces them in your Datascape reports, server callbacks, and cloud storage uploads.
For more information on configuring events in Adjust, see the Add events guide in the Help Center.
How it works
Events are represented by AdjustEvent2dx
instances. The AdjustEvent2dx
class contains properties which you can populate with event information to send to Adjust. The AdjustEvent2dx
class MUST be instantiated using an Adjust event token. You can find your event token in AppView by following the steps in the Add events guide. You can set each property to create a complete representation of your event.
Once you've set all the properties you need to set, use the Adjust2dx::trackEvent()
method to send the AdjustEvent2dx
instance to Adjust. When Adjust receives this object, it records the event information for you to report on.
Reference
The AdjustEvent2dx
class is used to hold information about an event. Each event is represented by a unique AdjustEvent2dx
instance.
Constructor
Instantiate an AdjustEvent2dx
object by passing your event token as an argument.
eventToken
(std::string
)Your Adjust event token. SeeAdd eventsfor more information.
Set event revenue
Set the revenue amount and currency code of any revenue associated with the event by calling the setRevenue()
method.
revenue
(double
)The amount of revenue generated by the event.
currency
(std::string
)TheISO 4217 codeof the event currency.
Add callback parameters
Add callback parameters by passing std::string
key-value pairs to the addCallbackParameter
method. When Adjust receives your AdjustEvent2dx
instance, all callback parameters are sent to your callback URL.
key
(std::string
)The name (key) of the parameter.
value
(std::string
)The value of the parameter.
Add partner parameters
Add callback parameters by passing string
key-value pairs to the addPartnerParameter()
method. When Adjust receives your AdjustEvent2dx
instance, all partner parameters are sent to any external partners you've configured.
key
(std::string
)The name (key) of the parameter.
value
(std::string
)The value of the parameter.
Set deduplication ID
Sets a unique identifier for the AdjustEvent2dx
instance to deduplicate revenue events by calling the setDeduplicationId()
method. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs.
deduplicationId
(std::string
)A unique deduplication ID.
Set a callback ID
Sets a unique identifier for Adjust's servers to report on in event callback by calling the setCallbackId
method.
callbackId
(std::string
)A unique callback ID.
Send an event
Call the Adjust2dx::trackEvent
method with your AdjustEvent2dx
instance as an argument to send your event to Adjust.
adjustEvent
(AdjustEvent2dx
)Your
AdjustEvent2dx
instance.
Tutorial
This tutorial demonstrates how to use the AdjustEvent2dx
class to send event information to Adjust. You will learn:
- How to create create and populate an
AdjustEvent2dx
instance. - How to use the
AdjustEvent2dx
class in your app to send event information to Adjust.
To send event information to Adjust, follow these steps:
- Instantiate and populate an
AdjustEvent2dx
object with your Adjust event token. In the example below, the following properties are set:- The event revenue is set to 0.25 and the currency code is set to EUR.
- The event deduplication ID is set to 5e85484b-1ebc-4141-aab7-25b869e54c49.
- The event token and revenue amount are added as callback parameters.
- The ID of the associated product and ID of the user who triggered the event are added as partner parameters.
- The callback ID is set to f2e728d8-271b-49ab-80ea-27830a215147.
- At the end of your function, send the information to Adjust by calling
Adjust2dx::trackEvent()
with yourAdjustEvent2dx
instance as an argument. - Call your function in response to an action in your app. In the example below, the function is called when the
Send Event
button is pressed.
You will see a log output containing the details of your AdjustEvent2dx
instance when the event is sent to Adjust.