### Record Revenue Events (GET Request) Source: https://dev.adjust.com/en/api/s2s-api/events This example demonstrates how to record revenue events using a GET request. It includes parameters for event token, app token, device ID, callback parameters, partner parameters, currency, revenue amount, and environment. ```shell curl "https://s2s.adjust.com/event?s2s=1&event_token=f0ob4r&app_token=4w565xzmb54d&idfa=D2CADB5F-410F-4963-AC0C-2A78534BDF1E&created_at=2017-01-02T15%3A04%3A05Z%2B0200&callback_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D&partner_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D¤cy=EUR&revenue=123.4&environment=sandbox" ``` -------------------------------- ### Adjust Session Tracking Response (Install) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This JSON object represents the successful response from Adjust when logging the first session for a device, which is categorized as an 'Install'. The `ask_in` field suggests a delay before the next tracking event is recommended. ```json { "app_token": "4w565xzmb54d", "adid": "df6c5653080670612cd2f9766ddc0814", "timestamp": "2024-07-09T01:31:14.373Z+0000", "message": "Install tracked", "ask_in": 2000 } ``` -------------------------------- ### Record Revenue Events (POST Request with URL Parameters) Source: https://dev.adjust.com/en/api/s2s-api/events This example shows how to record revenue events using a POST request with parameters appended to the URL. It includes essential event and revenue details. ```shell curl -X POST \ "https://s2s.adjust.com/event?s2s=1&event_token=f0ob4r&app_token=4w565xzmb54d&idfa=D2CADB5F-410F-4963-AC0C-2A78534BDF1E&created_at=2017-01-02T15%3A04%3A05Z%2B0200&callback_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D&partner_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D¤cy=EUR&revenue=123.4&environment=sandbox" ``` -------------------------------- ### POST /session Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Tracks app sessions for a device. The first session is logged as an 'install', subsequent sessions as 'session'. Reattribution criteria can trigger 'reattribution' or 'reattribution reinstall' activities. ```APIDOC ## POST /session ### Description Tracks app sessions for a device. The first session is logged as an 'install', subsequent sessions as 'session'. Reattribution criteria can trigger 'reattribution' or 'reattribution reinstall' activities. ### Method POST ### Endpoint https://app.adjust.com/session ### Parameters #### Query Parameters - **s2s** (integer) - Required - Set to 1 for S2S requests. - **os_name** (string) - Required - The name of the operating system (e.g., 'ios', 'android'). - **app_token** (string) - Required - Your Adjust app token. - **idfa** (string) - Required (for iOS) - The IDFA of the device. - **att_status** (integer) - Required (for iOS) - The App Tracking Transparency status. - **idfv** (string) - Optional (for iOS) - The IDFV of the device. - **primary_dedupe_token** (string) - Optional - A token to deduplicate events. - **created_at_unix** (integer) - Required - Unix timestamp of when the session occurred. Must be at least 20 minutes after the last logged session. - **device_name** (string) - Optional - The name of the device. - **device_type** (string) - Optional - The type of the device (e.g., 'iPhone', 'Android'). - **os_version** (string) - Optional - The version of the operating system. - **ip_address** (string) - Optional - The IP address of the device. - **environment** (string) - Optional - The environment of the app (e.g., 'sandbox', 'production'). - **callback_params** (JSON object) - Optional - Custom callback parameters as a JSON string. - **partner_params** (JSON object) - Optional - Custom partner parameters as a JSON string. ### Request Example ```curl curl -X POST "https://app.adjust.com/session" \ -H "Authorization: Bearer ADD_YOUR_AUTH_TOKEN_HERE" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "s2s=1\n&os_name=ios\n&app_token=i9dukg8o5slc\n&idfa=29DDE430-CE81-4F00-A50C-689595AAD142\n&att_status=3\n&idfv=59E27F41-A86B-4560-B585-63161F871C4B\n&primary_dedupe_token=3b35fcfb-6115-4cff-830f-e32a248c487d\n&created_at_unix=1484085154\n&device_name=iPhone16%2C2\n&device_type=iPhone\n&os_version=17.5.1\n&ip_address=192.0.0.1\n&environment=sandbox\n&callback_params=%7B%22user_id%22%3A%20%222696775149%22%2C%20%22user_category%22%3A%20%22high%20value%22%7D\n&partner_params=%7B%22analytics_user_id%22%3A%20%223913132433%22%2C%20%22analytics_session_id%22%3A%20%22nzFC9LKSqM%22%7D" -w "\n\nHTTP Status Code: %{http_code}\n"\ -s ``` ### Response #### Success Response (200) - **app_token** (string) - The app token. - **adid** (string) - The Adjust Ad ID. - **timestamp** (string) - The timestamp of the event. - **message** (string) - A message indicating the result (e.g., 'Install tracked', 'Session tracked'). - **ask_in** (integer) - The time in seconds until the next attribution check. #### Response Example (Install) ```json { "app_token": "4w565xzmb54d", "adid": "df6c5653080670612cd2f9766ddc0814", "timestamp": "2024-07-09T01:31:14.373Z+0000", "message": "Install tracked", "ask_in": 2000 } ``` #### Response Example (Session) ```json { "app_token": "4w565xzmb54d", "adid": "df6c5653080670612cd2f9766ddc0814", "timestamp": "2024-07-09T02:31:14.373Z+0000", "message": "Session tracked", "ask_in": 5000 } ``` ``` -------------------------------- ### Share Custom Data with Partner Parameters (cURL) Source: https://dev.adjust.com/en/api/s2s-api/events This example shows how to send custom event data to network partners using the `partner_params` parameter. The data is formatted as a URL-encoded JSON object. ```shell curl --location https://s2s.adjust.com/event?s2s=1&event_token=f0ob4r&app_token=4w565xzmb54d&idfa=8A3CB124-5A79-4334-8802-F75FEC099C58&partner_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D ``` -------------------------------- ### Record Revenue Events (POST Request with Body) Source: https://dev.adjust.com/en/api/s2s-api/events This example illustrates recording revenue events via a POST request, sending parameters in the request body. This method is useful for longer parameter lists or when avoiding URL length limitations. ```shell curl -X POST \ -H "Content-Type: application/x-www-form-urlencoded" \ --data "s2s=1&event_token=f0ob4r&app_token=4w565xzmb54d&idfa=D2CADB5F-410F-4963-AC0C-2A78534BDF1E&created_at=2017-01-02T15%3A04%3A05Z%2B0200&callback_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D&partner_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D¤cy=EUR&revenue=123.4&environment=sandbox" \ "https://s2s.adjust.com/event" ``` -------------------------------- ### Share Custom Data with Callback Parameters (cURL) Source: https://dev.adjust.com/en/api/s2s-api/events This example demonstrates how to send custom event data to Adjust using the `callback_params` parameter. The data is provided as a URL-encoded JSON object and will be available in raw data exports. ```shell curl --location https://s2s.adjust.com/event?s2s=1&event_token=f0ob4r&app_token=4w565xzmb54d&idfa=8A3CB124-5A79-4334-8802-F75FEC099C58&callback_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D ``` -------------------------------- ### POST /session Source: https://dev.adjust.com/en/api/s2s-api/index Notifies Adjust of session data. This endpoint allows you to send session start and end times for user activity tracking. ```APIDOC ## POST /session ### Description Notifies Adjust of session data. ### Method `POST` ### Endpoint `https://s2s.adjust.com/session` ### Parameters #### Query Parameters * **app_token** (string) - Required - Your app token. * **s2s_token** (string) - Required - Your S2S API token. * **user_identifier** (string) - Required - The identifier for the user (e.g., `idfa`, `gps_adid`, `android_id`). * **identifier_type** (string) - Required - The type of `user_identifier` provided (e.g., `idfa`, `gps_adid`, `android_id`). * **session_start** (string) - Required - Timestamp of when the session started (ISO 8601 format). * **session_end** (string) - Required - Timestamp of when the session ended (ISO 8601 format). * **last_session_success** (boolean) - Optional - Indicates if the previous session ended successfully. `true` or `false`. ### Request Example ``` https://s2s.adjust.com/session?app_token=YOUR_APP_TOKEN&s2s_token=YOUR_S2S_TOKEN&idfa=123e4567-e89b-12d3-a456-426614174000&identifier_type=idfa&session_start=2023-10-27T10:00:00Z&session_end=2023-10-27T10:15:00Z&last_session_success=true ``` ### Response #### Success Response (200) - **OK** (string) - Indicates the session data was successfully recorded. #### Response Example ```json "OK" ``` #### Error Response - **HTTP Error Code** (integer) - Standard HTTP error code (e.g., 400, 401, 403, 404, 413, 451, 500). - **JSON Message** (object) - Contains an error message detailing the issue. ##### Example Error Response ```json { "error": "Event request failed (Bad event state)" } ``` ``` -------------------------------- ### Adjust Session Tracking Response (Subsequent Session) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This JSON object shows the successful response from Adjust when logging subsequent sessions for a device. Similar to the install response, it includes tracking details and an `ask_in` value indicating recommended timing for the next event. ```json { "app_token": "4w565xzmb54d", "adid": "df6c5653080670612cd2f9766ddc0814", "timestamp": "2024-07-09T02:31:14.373Z+0000", "message": "Session tracked", "ask_in": 5000 } ``` -------------------------------- ### Get or Create Primary Deduplication Token (Objective-C) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Retrieves an existing primary deduplication token or generates and saves a new one if none exists. It relies on `getPrimaryDedupeToken` and `setPrimaryDedupeToken`. If token creation and saving fail, it throws an exception. ```objective-c NSUUID *getOrCreatePrimaryDedupeToken(void) { NSUUID *existingToken = getPrimaryDedupeToken(bundleId); if (existingToken) { return existingToken; } else { NSUUID *newToken = [NSUUID UUID]; if (setPrimaryDedupeToken(newToken, bundleId)) { return newToken; } @throw [NSException exceptionWithName:@"TokenSaveError" reason:@"Failed to save primary dedupe token" userInfo:nil]; } } ``` -------------------------------- ### Add Callback Parameters to Event (Swift/Kotlin) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide These code examples demonstrate how to add custom callback parameters, like transaction IDs, to event requests. It covers both scenarios: appending to existing `callback_params` or creating the parameter if it doesn't exist. This allows for richer event-level data. ```swift // If callback_params exists, add the event callback parameters to it (for example: txn_id) params["callback_params"] = '{"user_id": "2696775149", "user_category": "high value", "txn_id": "8837853376"}' // If callback_params does not exist, create it params["callback_params"] = '{"txn_id": "8837853376"}' ``` ```kotlin // If callback_params exists, add the event callback parameters to it (for example: txn_id) params["callback_params"] = '{"user_id": "2696775149", "user_category": "high value", "txn_id": "8837853376"}' // If callback_params does not exist, create it params["callback_params"] = '{"txn_id": "8837853376"}' ``` -------------------------------- ### Construct S2S Request Parameters in Java Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This Java code snippet demonstrates how to initialize a HashMap to store parameters for Adjust Server-to-Server (S2S) requests. It sets the required 's2s' value, the operating system name, and the app token. This client-side example should be adapted for server-side implementation in production environments. ```java Map params = new HashMap<>(); // Hard-coded params.put("s2s", "1"); // The name of the operating system running on the device params.put("os_name", "android"); // Replace with your Adjust app token params.put("app_token", "4w565xzmb54d"); ``` -------------------------------- ### Construct S2S Request Parameters in Swift Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This Swift code snippet demonstrates how to create a dictionary of parameters for Adjust Server-to-Server (S2S) requests. It includes the hardcoded 's2s' value, the operating system name, and a placeholder for the Adjust app token. This is a client-side example, and server-side implementation is recommended for production. ```swift var params: [String: String] = [: ] // Hard-coded params["s2s"] = "1" // The name of the operating system running on the device params["os_name"] = "ios" // Replace with your Adjust app token params["app_token"] = "4w565xzmb54d" ``` -------------------------------- ### Send Session Request with DMA Parameters (cURL) Source: https://dev.adjust.com/en/api/s2s-api/sessions Example of a cURL request to the Adjust S2S session endpoint, including parameters for DMA compliance. This demonstrates how to format the request with necessary headers and form data for session tracking. ```curl curl -X "POST" \ -H 'Authorization: Bearer ADD_YOUR_AUTH_TOKEN_HERE' \ -H 'User-Agent: Adjust Streaming Job (akka-http)' \ -d "app_token=a1234b2x3a4o&app_version=Roku%2FDVP-10.5+%2810.5.0.0010%29&created_at_unix=1543915806015&environment=production&os_name=roku-os&rida=099aa0bc-d123-4567-8999-a1b7c50767b1&s2s=1" \ "https://s2s.adjust.com/session" ``` -------------------------------- ### Construct S2S Request Parameters in Objective-C Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This Objective-C code snippet shows how to initialize an NSMutableDictionary to hold parameters for Adjust Server-to-Server (S2S) requests. It sets the mandatory 's2s' parameter, the OS name, and the app token. This example is for client-side demonstration; server-side implementation is advised for production environments. ```objectivec NSMutableDictionary *params = [NSMutableDictionary dictionary]; // Hard-coded params[@"s2s"] = @"1"; // The name of the operating system running on the device params[@"os_name"] = @"ios"; // Replace with your Adjust app token params[@"app_token"] = @"4w565xzmb54d"; ``` -------------------------------- ### Get Tracking Info (Objective-C) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Retrieves tracking authorization status for iOS 14.5+ or tracking enabled status for earlier versions. Returns a TrackingInfo object containing either ATT status or tracking enabled status. Requires the AdSupport framework. ```Objective-C #import @interface TrackingInfo : NSObject @property (nonatomic, assign) ATTrackingManagerAuthorizationStatus attStatus; @property (nonatomic, strong) NSNumber *trackingEnabled; @end @implementation TrackingInfo @end void getTrackingInfo(void (^completion)(TrackingInfo *)) { // For iOS 14.5+, get ATT status without showing prompt if (@available(iOS 14.5, *)) { TrackingInfo *info = [[TrackingInfo alloc] init]; info.attStatus = ATTrackingManager.trackingAuthorizationStatus; completion(info); // For earlier versions, get tracking enabled status } else { TrackingInfo *info = [[TrackingInfo alloc] init]; BOOL enabled = [ASIdentifierManager sharedManager].isAdvertisingTrackingEnabled; info.trackingEnabled = @(enabled); completion(info); } } // Usage example getTrackingInfo(^(TrackingInfo *info) { // Include ATT status if available, otherwise tracking enabled status, never both if (info.attStatus != nil) { params[@"att_status"] = [NSString stringWithFormat:@"%ld", (long)info.attStatus]; } else if (info.trackingEnabled != nil) { params[@"tracking_enabled"] = [info.trackingEnabled boolValue] ? @"1" : @"0"; } }); ``` -------------------------------- ### Send S2S Ad Revenue via POST Request (cURL) Source: https://dev.adjust.com/en/api/s2s-api/ad-revenue This example demonstrates how to send ad revenue data to the Adjust S2S API using a cURL POST request. It includes essential parameters like app token, device ID, source, revenue, currency, and the s2s flag. Ensure proper authorization and parameter values for successful integration. ```shell curl -X POST \ -H "Authorization: Bearer b9eb9d6228842aeb05d64f30d56b361e" \ "https://s2s.adjust.com/ad_revenue?app_token=abc123abc123&idfa=FAD135C7-C5F8-4DCC-9478-2203956B0870&source=publisher&ad_impressions_count=1&revenue=0.01¤cy=USD&s2s=1" ``` -------------------------------- ### Construct S2S Request Parameters in Kotlin Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This Kotlin code snippet illustrates creating a mutable map for Adjust Server-to-Server (S2S) API requests. It includes the essential 's2s' parameter, the device's operating system name, and your Adjust app token. While shown client-side, it's recommended to handle these parameters server-side in a production setup. ```kotlin val params = mutableMapOf() // Hard-coded params["s2s"] = "1" // The name of the operating system running on the device params["os_name"] = "android" // Replace with your Adjust app token params["app_token"] = "4w565xzmb54d" ``` -------------------------------- ### Get IDFA and ATT Status (Objective-C) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Retrieves the Identifier for Advertisers (IDFA) and App Tracking Transparency (ATT) status for use in server-to-server tracking. Handles different iOS versions by checking for ATT status or fallback to tracking enabled status. Requires the AdSupport framework. ```Objective-C #import @interface IDFAInfo : NSObject @property (nonatomic, strong) NSUUID *idfa; @property (nonatomic, strong) NSNumber *trackingEnabled; @property (nonatomic, assign) NSNumber *attStatus; @end @implementation IDFAInfo @end void getIDFAInfo(void (^completion)(IDFAInfo *)) { // For iOS 14.5+, get ATT status without showing prompt if (@available(iOS 14.5, *)) { ASIdentifierManager *manager = [ASIdentifierManager sharedManager]; IDFAInfo *info = [[IDFAInfo alloc] init]; if (manager.isAdvertisingTrackingEnabled) { info.idfa = manager.advertisingIdentifier; } info.trackingEnabled = @(manager.isAdvertisingTrackingEnabled); completion(info); // For earlier versions, don't show ATT prompt. Just get IDFA and tracking // enabled status. } else { ASIdentifierManager *manager = [ASIdentifierManager sharedManager]; IDFAInfo *info = [[IDFAInfo alloc] init]; if (manager.isAdvertisingTrackingEnabled) { info.idfa = manager.advertisingIdentifier; } info.trackingEnabled = @(manager.isAdvertisingTrackingEnabled); completion(info); } } // Usage example getIDFAInfo(^(IDFAInfo *info) { // Include IDFA if available if (info.idfa) { params[@"idfa"] = [info.idfa UUIDString]; } // Include ATT status if available, otherwise tracking enabled status, never both if (info.attStatus != nil) { params[@"att_status"] = [NSString stringWithFormat:@"%ld", (long)info.attStatus]; } else if (info.trackingEnabled != nil) { params[@"tracking_enabled"] = [info.trackingEnabled boolValue] ? @"1" : @"0"; } }); ``` -------------------------------- ### Add Post-Install Event Parameters (Swift/Kotlin) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide These code snippets illustrate how to add event-specific parameters, such as an event token, revenue, and currency, to an existing parameters dictionary for post-install event tracking. This is crucial for attributing marketing campaigns to specific user actions. ```swift // Add event token to existing params params["event_token"] = "2y7e81" // Add revenue and currency, if applicable // These parameters are equivalent to $19.99 params["revenue"] = "19.99" params["currency"] = "USD" ``` ```kotlin // Add event token to existing params params["event_token"] = "2y7e81" // Add revenue and currency, if applicable // These parameters are equivalent to $19.99 params["revenue"] = "19.99" params["currency"] = "USD" ``` -------------------------------- ### Get IDFV (Objective-C) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Retrieves the Identifier for Vendors (IDFV) for the current device. This is a fallback identifier available on all modern iOS devices. The IDFV is returned as a UUID string. ```Objective-C NSUUID *idfv = [[UIDevice currentDevice] identifierForVendor]; if (idfv) { params[@"idfv"] = [idfv UUIDString]; } ``` -------------------------------- ### Get IDFV (Swift) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Retrieves the Identifier for Vendors (IDFV) for the current device. This is a fallback identifier available on all modern iOS devices. The IDFV is returned as a UUID string. ```Swift let idfv: UUID? = UIDevice.current.identifierForVendor if let idfvString = idfv?.uuidString { params["idfv"] = idfvString } ``` -------------------------------- ### Post-install Event Tracking Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Allows tracking of post-install events, which represent marketing goals and can be used for campaign optimization. Revenue and currency can be included for purchase events. ```APIDOC ## Post-install Event Tracking ### Description Allows tracking of post-install events, which represent marketing goals and can be used for campaign optimization. Revenue and currency can be included for purchase events. ### Parameters #### Query Parameters - **event_token** (string) - Required - The token for the specific event. - **revenue** (string) - Optional - The revenue generated by the event (e.g., '19.99'). - **currency** (string) - Optional - The currency of the revenue (e.g., 'USD'). - **callback_params** (JSON object) - Optional - Custom callback parameters as a JSON string. Can include event-level custom data like transaction IDs. ### Request Example (with revenue and currency) ``` params["event_token"] = "2y7e81" params["revenue"] = "19.99" params["currency"] = "USD" ``` ### Callback Parameters Example ``` // If callback_params exists, add the event callback parameters to it (for example: txn_id) params["callback_params"] = '{"user_id": "2696775149", "user_category": "high value", "txn_id": "8837853376"}' // If callback_params does not exist, create it params["callback_params"] = '{"txn_id": "8837853376"}' ``` ``` -------------------------------- ### Send S2S Events Source: https://dev.adjust.com/en/api/s2s-api/events The /event endpoint is used to send server-to-server events to Adjust. It accepts GET requests with URL parameters, or POST requests with either URL parameters or a form-urlencoded request body. ```APIDOC ## POST /event ### Description Sends custom event data to Adjust using server-to-server communication. ### Method POST ### Endpoint https://s2s.adjust.com/event ### Parameters #### Query Parameters - **idfa** (string) - Required - Advertising ID for iOS devices. - **gps_adid** (string) - Required - Advertising ID for Android devices. - **event_token** (string) - Required - Adjust event token from the dashboard. - **app_token** (string) - Required - Adjust app token from the dashboard. - **s2s** (string) - Required - Must be set to `1` to indicate a server-to-server request. - **adid** (string) - Optional - Adjust identifier for the device, useful for LAT users on iOS without IDFA. - **ip_address** (string) - Optional - The IPv4 address of the device. - **created_at_unix** (integer) - Optional - The UNIX timestamp at which the event occurred. - **created_at** (string) - Optional - The timestamp at which the event occurred in ISO 8601 format (URL encoded). - **user_agent** (string) - Optional - The `User-Agent` of the device (URL encoded). *Note: A comprehensive list of device IDs can be used instead of `idfa` or `gps_adid`.* ### Request Example (POST with form-urlencoded body) ``` Content-Type: application/x-www-form-urlencoded idfa=D2CADB5F-410F-4963-AC0C-2A78534BDF1E&gps_adid=660e1d86-6796-463a-be86-897993136018&event_token=f0ob4r&app_token=4w565xzmb54d&s2s=1&created_at_unix=1484085154 ``` ### Response #### Success Response (200) Adjust typically returns a success confirmation or specific event data. #### Response Example ```json { "message": "Event received successfully" } ``` ## GET /event ### Description Sends custom event data to Adjust using server-to-server communication via URL parameters. ### Method GET ### Endpoint https://s2s.adjust.com/event ### Parameters #### Query Parameters - **idfa** (string) - Required - Advertising ID for iOS devices. - **gps_adid** (string) - Required - Advertising ID for Android devices. - **event_token** (string) - Required - Adjust event token from the dashboard. - **app_token** (string) - Required - Adjust app token from the dashboard. - **s2s** (string) - Required - Must be set to `1` to indicate a server-to-server request. - **adid** (string) - Optional - Adjust identifier for the device, useful for LAT users on iOS without IDFA. - **ip_address** (string) - Optional - The IPv4 address of the device. - **created_at_unix** (integer) - Optional - The UNIX timestamp at which the event occurred. - **created_at** (string) - Optional - The timestamp at which the event occurred in ISO 8601 format (URL encoded). - **user_agent** (string) - Optional - The `User-Agent` of the device (URL encoded). *Note: A comprehensive list of device IDs can be used instead of `idfa` or `gps_adid`.* ### Request Example ``` https://s2s.adjust.com/event?idfa=D2CADB5F-410F-4963-AC0C-2A78534BDF1E&gps_adid=660e1d86-6796-463a-be86-897993136018&event_token=f0ob4r&app_token=4w565xzmb54d&s2s=1&created_at_unix=1484085154 ``` ### Response #### Success Response (200) Adjust typically returns a success confirmation or specific event data. #### Response Example ```json { "message": "Event received successfully" } ``` ``` -------------------------------- ### Get Google Advertising ID Info (Kotlin) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide A suspending function in Kotlin that retrieves the Google Advertising ID and its tracking status. It uses `AdvertisingIdClient.getAdvertisingIdInfo` within a coroutine for background processing and handles potential exceptions. ```kotlin import com.google.android.gms.ads.identifier.AdvertisingIdClient import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext suspend fun getGoogleAdvertisingIdInfo( context: Context): AdvertisingIdClient.Info? { return withContext(Dispatchers.IO) { try { AdvertisingIdClient.getAdvertisingIdInfo(context) } catch (e: Exception) { null } } } ``` -------------------------------- ### Add Unix Timestamp for S2S Requests Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This snippet shows how to include a Unix timestamp in your Server-to-Server (S2S) requests to improve attribution accuracy. The timestamp represents the time of the activity on the device. Examples are provided for both Swift and Kotlin. ```swift // Unix timestamp of when activity occurred on device // Code example shows how to retrieve current time in seconds // Example value: "1484085154" params["created_at_unix"] = String(Int(Date().timeIntervalSince1970)) ``` ```kotlin // Unix timestamp of when activity occurred on device // Code example shows how to retrieve current time in seconds // Example value: "1484085154" params["created_at_unix"] = (System.currentTimeMillis() / 1000).toString() ``` -------------------------------- ### Environment Configuration Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Specify the environment for your requests using the `environment` parameter. This helps in separating test data from production data. ```APIDOC ## POST /your-s2s-endpoint ### Description Configure the environment for S2S requests to separate testing and production data. ### Method POST ### Endpoint /your-s2s-endpoint ### Parameters #### Query Parameters - **environment** (string) - Optional - Specifies the environment. Available values: `sandbox` (for testing), `production` (for live app). Defaults to `production`. ### Request Example ```json { "device_name": "iPhone10,5", "device_type": "iPhone", "os_version": "17.5.1", "ip_address": "192.0.0.1", "environment": "sandbox" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the request. - **message** (string) - A message providing details about the request outcome. #### Response Example ```json { "status": "success", "message": "Data processed successfully." } ``` ``` -------------------------------- ### Add Partner Parameters to Event (Swift/Kotlin) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This snippet demonstrates how to add custom partner parameters to an event request. It covers both cases where 'partner_params' already exists and where it needs to be created. These parameters are sent to Adjust's servers and included in callbacks to partners. ```swift // If partner_params exists, add the event partner parameters to it (for example: item_id) params["partner_params"] = '{"analytics_user_id": "3913132433", "analytics_session_id": "nzFC9LKSqM", "item_id": "["76524","62599"]"}' // If partner_params does not exist, create it params["partner_params"] = '{"item_id": "["76524","62599"]"}' ``` ```kotlin // If partner_params exists, add the event partner parameters to it (for example: item_id) params["partner_params"] = '{"analytics_user_id": "3913132433", "analytics_session_id": "nzFC9LKSqM", "item_id": "["76524","62599"]"}' // If partner_params does not exist, create it params["partner_params"] = '{"item_id": "["76524","62599"]"}' ``` -------------------------------- ### POST /session - Provide Consent Data for Google DMA Compliance Source: https://dev.adjust.com/en/api/s2s-api/sessions This endpoint allows you to send consent data to Google to comply with the EU's Digital Markets Act (DMA). It supports parameters like `eea`, `ad_personalization`, `ad_user_data`, and `npa`. ```APIDOC ## POST /session ### Description This endpoint is used to send consent data to Google services to comply with the EU's Digital Markets Act (DMA). It is crucial for users interacting with Google Ads and Google Marketing Platform. ### Method POST ### Endpoint https://s2s.adjust.com/session ### Parameters #### Query Parameters - **app_token** (string) - Required - Your Adjust app token. - **app_version** (string) - Optional - The version of the app. - **created_at_unix** (integer) - Required - Timestamp of the event in Unix milliseconds. - **environment** (string) - Required - The environment of the app (e.g., 'production', 'sandbox'). - **os_name** (string) - Required - The name of the operating system (e.g., 'android', 'ios', 'roku-os'). - **rida** (string) - Required - The Adjust SDK instance ID. - **s2s** (integer) - Required - Set to 1 to indicate a server-to-server call. - **eea** (integer) - Optional - 1 if the user is in the EEA and DMA applies, 0 otherwise. Informs Google about user location for DMA applicability. - **ad_personalization** (integer) - Optional - 1 if the user consented to personalized ads via Google Ads, 0 otherwise. Required when working with Google Ads. - **ad_user_data** (integer) - Optional - 1 if the user consented to personal data sharing for measurement, 0 otherwise. Applies to Core Platform Services. - **npa** (integer) - Optional - 1 if the user consented to non-personalized ads via Google Marketing Platform, 0 otherwise. Required when working with Google Marketing Platform. ### Request Example ```curl curl -X "POST" \ -H "Authorization: Bearer ADD_YOUR_AUTH_TOKEN_HERE" \ -H "User-Agent: Adjust Streaming Job (akka-http)" \ -d "app_token=a1234b2x3a4o&app_version=Roku%2FDVP-10.5+%2810.5.0.0010%29&created_at_unix=1543915806015&environment=production&os_name=roku-os&rida=099aa0bc-d123-4567-8999-a1b7c50767b1&s2s=1&eea=1&ad_personalization=1&npa=0" \ "https://s2s.adjust.com/session" ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request (e.g., 'success'). - **message** (string) - A message providing details about the request outcome. #### Response Example ```json { "status": "success", "message": "Event processed successfully" } ``` #### Error Response (4xx/5xx) - **status** (string) - Indicates the status of the request (e.g., 'error'). - **message** (string) - A message describing the error. #### Error Response Example ```json { "status": "error", "message": "Invalid app token provided" } ``` ``` -------------------------------- ### Example S2S Request Headers (cURL) Source: https://dev.adjust.com/en/api/s2s-api/security This snippet shows the HTTP request headers that would be sent with an authenticated S2S event request using cURL. It highlights the Host, User-Agent, Accept, and Authorization headers. ```http > POST /event?s2s=1&app_token=abc123kuvada7&event_token=xyzklm&gps_adid=11110111-2345-6789-1122-000000005678 HTTP/1.1 > Host: s2s.adjust.com > User-Agent: curl/7.54.0 > Accept: */* > Authorization: Bearer v8s5opi0zs45607l8h8c48wak2vxb5oe ``` -------------------------------- ### Get Tracking Info (Swift) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Retrieves tracking authorization status for iOS 14.5+ or tracking enabled status for earlier versions. Returns a struct containing either ATT status or tracking enabled status. Requires the AdSupport and AppTrackingTransparency frameworks. ```Swift import AdSupport struct TrackingInfo { let attStatus: ATTrackingManager.AuthorizationStatus? let trackingEnabled: Bool? } func getTrackingInfo(completion: @escaping (TrackingInfo) -> Void) { // For iOS 14.5+, get ATT status without showing prompt if #available(iOS 14.5, *) { let status = ATTrackingManager.trackingAuthorizationStatus completion(TrackingInfo(attStatus: status, trackingEnabled: nil)) // For earlier versions, get tracking enabled status } else { let trackingEnabled = ASIdentifierManager.shared().isAdvertisingTrackingEnabled completion(TrackingInfo(attStatus: nil, trackingEnabled: trackingEnabled)) } } // Usage example getTrackingInfo { info in // Include ATT status if available, otherwise tracking enabled status, never both if let attStatus = info.attStatus { params["att_status"] = String(attStatus.rawValue) } else if let trackingEnabled = info.trackingEnabled { params["tracking_enabled"] = trackingEnabled ? "1" : "0" } } ``` -------------------------------- ### Send S2S Session Request (cURL) Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide This cURL command demonstrates how to send a server-to-server session request to Adjust's API. It includes essential parameters like app token, device identifiers, and timestamps. Ensure your auth token is valid and the `created_at_unix` parameter meets Adjust's time requirements. ```curl curl -X POST "https://app.adjust.com/session" \ -H "Authorization: Bearer ADD_YOUR_AUTH_TOKEN_HERE" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "s2s=1\n&os_name=ios\n&app_token=i9dukg8o5slc\n&idfa=29DDE430-CE81-4F00-A50C-689595AAD142\n&att_status=3\n&idfv=59E27F41-A86B-4560-B585-63161F871C4B\n&primary_dedupe_token=3b35fcfb-6115-4cff-830f-e32a248c487d\n&created_at_unix=1484085154\n&device_name=iPhone16%2C2\n&device_type=iPhone\n&os_version=17.5.1\n&ip_address=192.0.0.1\n&environment=sandbox\n&callback_params=%7B%22user_id%22%3A%20%222696775149%22%2C%20%22user_category%22%3A%20%22high%20value%22%7D\n&partner_params=%7B%22analytics_user_id%22%3A%20%223913132433%22%2C%20%22analytics_session_id%22%3A%20%22nzFC9LKSqM%22%7D" \ -w "\n\nHTTP Status Code: %{http_code}\n" \ -s ``` -------------------------------- ### Send GDPR Forget Device Request (cURL) Source: https://dev.adjust.com/en/api/s2s-api/data-erasure-api This cURL command demonstrates how to send a POST request to the GDPR forget device endpoint. It includes the necessary query parameters such as app token and a device identifier (IDFA in this example). ```shell curl -X POST "https://gdpr.adjust.com/gdpr_forget_device?s2s=1&app_token=kwrqhymtnsr2&idfa=9C5CBC1D-4F42-4764-A5E6-84DAF3D24707" ``` -------------------------------- ### Global Partner Parameters Source: https://dev.adjust.com/en/api/s2s-api/s2s-developer-guide Include 'global partner parameters' in all S2S requests when integrating with specific partners. Adjust's servers pass these parameters in all callbacks made to partners. ```APIDOC ## POST /your-s2s-endpoint ### Description Pass custom key-value pairs to partners via Adjust's S2S callbacks, commonly used for analytics partner integrations. ### Method POST ### Endpoint /your-s2s-endpoint ### Parameters #### Request Body - **partner_params** (object) - Optional - A JSON object containing string key-value pairs for custom partner parameters (e.g., `{"analytics_id": "xyz789"}`). ### Request Example ```json { "device_name": "iPhone10,5", "device_type": "iPhone", "os_version": "17.5.1", "ip_address": "192.0.0.1", "partner_params": { "analytics_user_id": "3913132433", "analytics_visitor_id": "nzFC9LKSqM" } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the request. - **message** (string) - A message providing details about the request outcome. #### Response Example ```json { "status": "success", "message": "Data processed successfully." } ``` ``` -------------------------------- ### Share Custom Data (Callback and Partner Parameters) Source: https://dev.adjust.com/en/api/s2s-api/events This endpoint allows you to send custom event data to Adjust using callback parameters for raw data exports and partner parameters for network partners. Both parameters accept a URL-encoded JSON object of string key-value pairs. ```APIDOC ## POST /event ### Description Send custom event data to Adjust using callback and partner parameters. ### Method POST ### Endpoint https://s2s.adjust.com/event ### Query Parameters - **s2s** (integer) - Required - Indicates a server-to-server request. - **event_token** (string) - Required - The token for the event to be tracked. - **app_token** (string) - Required - The token for the Adjust app. - **idfa** (string) - Required - The IDFA of the device. - **callback_params** (string) - Optional - A URL-encoded JSON object containing string key-value pairs for callback parameters. - **partner_params** (string) - Optional - A URL-encoded JSON object containing string key-value pairs for partner parameters. ### Request Example (Callback Parameters) ```bash curl --location https://s2s.adjust.com/event?s2s=1&event_token=f0ob4r&app_token=4w565xzmb54d&idfa=8A3CB124-5A79-4334-8802-F75FEC099C58&callback_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D ``` ### Request Example (Partner Parameters) ```bash curl --location https://s2s.adjust.com/event?s2s=1&event_token=f0ob4r&app_token=4w565xzmb54d&idfa=8A3CB124-5A79-4334-8802-F75FEC099C58&partner_params=%7B%22f0o%22%3A%22bar%22%2C%20%22bar%22%3A%22baz%22%7D ``` ### Success Response (200) (No specific success response body is detailed in the provided text, but typically indicates successful event processing.) ```