adjust-icon

Set up callbacks

Set up callbacks to trigger functions when the SDK sends information to Adjust. You can set up callbacks for sessions and events.

Session callbacks

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 Adjust’s servers. 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.

Success callbacks

Property declaration
public Action<AdjustSessionSuccess> SessionTrackingSucceeded { get; set; }

Set up success callbacks to trigger functions when the SDK records a session.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.SessionTrackingSucceeded = adjustSessionSuccess =>
{
//...
};
Adjust.ApplicationLaunching(config);

Example

This example shows how to log the timestamp at which the SDK recorded the session.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.SessionTrackingSucceeded = adjustSessionSuccess =>
{
System.Diagnostics.Debug.WriteLine(adjustSessionSuccess.Timestamp)
};
Adjust.ApplicationLaunching(config);

Failure callbacks

Property declaration
public Action<AdjustSessionFailure> SessionTrackingFailed { get; set; }

Set up failure callbacks to trigger functions when the SDK fails to record a session.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.EventTrackingFailed = adjustEventFailure =>
{
//...
};
Adjust.ApplicationLaunching(config);

Example

This example shows how to log the session failure message.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.SessionTrackingFailed = adjustSessionFailure =>
{
System.Diagnostics.Debug.WriteLine(adjustSessionFailure.Message)
};
Adjust.ApplicationLaunching(config);

Event callbacks

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 Adjust’s servers. 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.

Success callbacks

Property declaration
public Action<AdjustEventSuccess> EventTrackingSucceeded { get; set; }

Set up success callbacks to trigger functions when the SDK records an event.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.EventTrackingSucceeded = adjustEventSuccess =>
{
//...
};
Adjust.ApplicationLaunching(config);

Example

This example shows how to log the timestamp at which the SDK recorded an event.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.EventTrackingSucceeded = adjustEventSuccess =>
{
System.Diagnostics.Debug.WriteLine(adjustEventSuccess.Timestamp)
};
Adjust.ApplicationLaunching(config);

Failure callbacks

Property declaration
public Action<AdjustEventFailure> EventTrackingFailed { get; set; }

Set up failure callbacks to trigger functions when the SDK fails to record an event.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.EventTrackingFailed = adjustEventFailure =>
{
//...
};
Adjust.ApplicationLaunching(config);

Example

This example shows how to log an event failure message.

var config = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
config.EventTrackingFailed = adjustEventFailure =>
{
System.Diagnostics.Debug.WriteLine(adjustEventFailure.Message)
};
Adjust.ApplicationLaunching(config);