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.
Set up session callbacks to trigger functions when the SDK sends session information. You can create success callbacks and failure callbacks. Success callbacks trigger when the SDK sends information to the Adjust backend. Failure callbacks trigger when the SDK encounters a problem while sending the information.
Session callbacks have access to a response data object. You can use its properties in your callback function.
Session data object
Property
Data type
Description
Message
String
The message from the server or the error logged by the SDK.
Timestamp
String
The timestamp from the Adjust backend.
Adid
String
A unique device identifier provided by Adjust.
JsonResponse
Dictionary <string, object>
The JSON object with the response from the server.
WillRetry
Boolean
Returned if the session object failed. Indicates whether there will be an attempt to resend the package at a later time.
In this example, we set up a callback function sessionSuccess and register it as a success callback. The function logs the timestamp at which the SDK measured the session.
C#
AdjustConfig adjustConfig = new AdjustConfig("{Your App Token}", AdjustEnvironment.Sandbox);
adjustConfig.setLogLevel(AdjustLogLevel.Verbose);
adjustConfig.setSessionSuccessDelegate(sessionSuccess);
// ...
Adjust.start(adjustConfig);
// ...
public void sessionSuccess (AdjustSessionSuccess sessionSuccessData) {
Debug.Log("Session measured at " + sessionSuccessData.Timestamp);
}
Set up event callbacks to trigger functions when the SDK sends event information. You can create success callbacks and failure callbacks. Success callbacks trigger when the SDK sends information to the Adjust backend. Failure callbacks trigger when the SDK encounters a problem while sending the information.
Event callbacks have access to a response data object. You can use its properties in your callback function.
Event data object
Property
Data type
Description
Message
String
The message from the server or the error logged by the SDK.
Timestamp
String
The timestamp from the Adjust backend.
Adid
String
A unique device identifier provided by Adjust.
JsonResponse
Dictionary <string, object>
The JSON object with the response from the server.
EventToken
String
The event token.
CallbackId
String
The custom defined callback ID set on event object.
WillRetry
Boolean
Returned if the event object failed. Indicates whether there will be an attempt to resend the package at a later time.
Set up success callbacks to trigger functions when the SDK measures an event.
C#
AdjustConfig adjustConfig = new AdjustConfig("{Your App Token}", AdjustEnvironment.Sandbox);
adjustConfig.setLogLevel(AdjustLogLevel.Verbose);
adjustConfig.setEventSuccessDelegate(EventSuccessCallback);
//...
Adjust.start(adjustConfig);
//...
public void EventSuccessCallback(AdjustEventSuccess eventSuccessData) {
//...
}
Example
In this example, we set up a callback function eventSuccess and register it as a success callback. The function logs the timestamp at which the SDK measured the event.
C#
AdjustConfig adjustConfig = new AdjustConfig("{Your App Token}", AdjustEnvironment.Sandbox);
adjustConfig.setLogLevel(AdjustLogLevel.Verbose);
adjustConfig.setEventSuccessDelegate(eventSuccess);
// ...
Adjust.start(adjustConfig);
// ...
public void eventSuccess (AdjustEventSuccess eventSuccessData) {
Debug.Log("Event measured at " + sessionSuccessData.Timestamp);
}