### Example market_referrer_gclid Parameter Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Shows the 'market_referrer_gclid' value, captured from the Play Install Referrer API. This parameter should be cached and sent with future conversion events. ```text BX3QojHp4mY5MrJtFM_d1u ``` -------------------------------- ### Example app_open_source Parameter Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Illustrates the 'app_open_source' parameter, used to differentiate between ad-clicked deep links and organic app sessions. It should be set to 'ad_click' or 'organic' for session start events. ```text ad_click or organic ``` -------------------------------- ### Example User-Agent Header Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Provides an example of the 'User-Agent' header, which includes information about the app and the device. This is a required header for tracking. ```text AdMob/7.10.1 (Android 6.0; en_US; SM-G900F; Build/MMB29M) ``` -------------------------------- ### Example SDK Version Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Provides an example of a required SDK version string. This value should exactly match the published release version of the SDK used by the app. If no SDK is used, it should mirror the app version. ```text 1.9.5r6 ``` -------------------------------- ### Example X-Forwarded-For Header Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Shows an example of the 'X-Forwarded-For' header, which contains the public IP address of the device where the event was measured. This is a required header. ```text 216.58.194.174 ``` -------------------------------- ### Android App Install Event Tracking (First Open) Source: https://developers.google.com/app-conversion-tracking/api/privacy-compliant-guide This code snippet demonstrates how to send a 'first_open' event for Android app installs when the Android Advertising ID is available. It requires the `market_referrer_gclid` parameter, which is parsed from the Play Install Referrer API. The `rdid` and `id_type` parameters specify the device identifier. ```http POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=first_open &rdid=0F7AB11F-DA50-498E-B225-21AC1977A85D &id_type=advertisingid &eea=0 &lat=0 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &market_referrer_gclid=BX3QojHp4mY5MrJtFM_d1u ``` -------------------------------- ### Example Timestamp Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Illustrates the format for a required UNIX timestamp, including seconds and microsecond precision. This timestamp indicates when a conversion event occurred. ```text 1432681913.123456 ``` -------------------------------- ### Example Currency Code Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Specifies the ISO 4217 currency code, which is required if a monetary value is provided. For example, 'USD' for US Dollars. ```text USD ``` -------------------------------- ### Example gbraid Parameter Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Represents the 'gbraid' value, captured from deep links. This parameter is vital for enabling non-user-level app conversion measurement on iOS and Android. ```text ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O ``` -------------------------------- ### Track App Conversion Events via HTTP POST Source: https://developers.google.com/app-conversion-tracking/api/privacy-compliant-guide Demonstrates the structure of a POST request to the App Conversion Tracking API. These examples cover session starts, in-app purchases, and organic sessions, requiring parameters such as dev_token, link_id, and event-specific identifiers. ```HTTP POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=session_start &rdid=00000000-0000-0000-0000-000000000000 &id_type=advertisingid &eea=0 &lat=1 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &market_referrer_gclid=BX3QojHp4mY5MrJtFM_d1u &gclid_only_request=1 &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O ``` ```HTTP POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=in_app_purchase &rdid=00000000-0000-0000-0000-000000000000 &id_type=advertisingid &eea=0 &lat=1 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &market_referrer_gclid=BX3QojHp4mY5MrJtFM_d1u &gclid_only_request=1 &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O ``` ```HTTP POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=session_start &rdid=0F7AB11F-DA50-498E-B225-21AC1977A85D &id_type=idfa &eea=0 &lat=0 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O &app_open_source=ad_click ``` -------------------------------- ### Example gclid Parameter Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Demonstrates the value of the 'gclid' query parameter, used when an app is opened via a deep link. This is crucial for attribution when 'app_event_type' is 'session_start' and a deep link with 'gclid' is involved. ```text Cj0KEQjw0dy4BRCuuL_e5M ``` -------------------------------- ### POST /pagead/conversion/app/1.1 Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Records an app conversion event, such as an in-app purchase or a session start, along with associated metadata and user consent flags. ```APIDOC ## POST /pagead/conversion/app/1.1 ### Description Records an app conversion event or session start. This endpoint is used to track user interactions and attribute them to specific advertising campaigns. ### Method POST ### Endpoint /pagead/conversion/app/1.1 ### Parameters #### Query Parameters - **dev_token** (string) - Required - Developer token for authentication. - **link_id** (string) - Required - Unique identifier for the app link. - **app_event_type** (string) - Required - The type of event (e.g., 'in_app_purchase', 'session_start'). - **rdid** (string) - Optional - Advertising ID (IDFA or AdvertisingID). - **id_type** (string) - Optional - Type of ID provided (e.g., 'idfa', 'advertisingid'). - **eea** (integer) - Optional - EEA user flag (1 for yes, 0 for no). - **ad_personalization** (integer) - Optional - User consent for ad personalization. - **ad_user_data** (integer) - Optional - User consent for ad user data. - **value** (float) - Optional - Monetary value of the conversion. - **currency_code** (string) - Optional - Currency code (e.g., 'USD'). #### Request Body - **app_event_data** (object) - Optional - Additional event-specific data (e.g., {"item_id": ["item1"]}). ### Request Example { "app_event_data": {"item_id": ["Crayons", "Markers"]} } ### Response #### Success Response (200) - **status** (string) - Confirmation of successful event processing. #### Response Example { "status": "success" } ``` -------------------------------- ### Example gclid_only_request Parameter Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Indicates the 'gclid_only_request' parameter, set to '1' when 'rdid' is unavailable or zero, and either 'gclid' or 'market_referrer_gclid' is present. This flag is essential for 'gclid'-based attribution in such scenarios. ```text 1 ``` -------------------------------- ### Example Monetary Value Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Shows an optional monetary value for an event. The value must be a machine-readable floating-point number with a decimal point. ```text 1.99 ``` -------------------------------- ### Constructing App Conversion Tracking Requests Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Examples of HTTP POST requests for tracking various app events. These requests include necessary headers, query parameters for device and campaign attribution, and optional JSON body data for event details. ```HTTP POST /pagead/conversion/app/1.1 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=in_app_purchase &rdid=00000000-0000-0000-0000-000000000000 &id_type=advertisingid &eea=0 &ad_personalization=1 &ad_user_data=1 &lat=1 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &value=1.99 ¤cy_code=USD &market_referrer_gclid=BX3QojHp4mY5MrJtFM_d1u &gclid=Cj0KEQjw0dy4BRCuuL_e5M &gclid_only_request=1 &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O Host: www.googleadservices.com User-Agent: MyAnalyticsCompany/1.0.0 (iOS 10.0.2; en_US; Android,1; Build/13D15; Proxy) X-Forwarded-For: 216.58.194.174 Content-Type: application/json; charset=utf-8 ``` ```JSON {"app_event_data":{"item_id":["Crayons","Markers"]}} ``` ```HTTP POST /pagead/conversion/app/1.1 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=session_start &rdid=0F7AB11F-DA50-498E-B225-21AC1977A85D &id_type=idfa &eea=0 &ad_personalization=1 &ad_user_data=1 &lat=0 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O Host: www.googleadservices.com User-Agent: MyAnalyticsCompany/1.0.0 (iOS 10.0.2; en_US; iPhone9,1; Build/13D15; Proxy) X-Forwarded-For: 216.58.194.174 Content-Type: application/json; charset=utf-8 ``` ```HTTP POST /pagead/conversion/app/1.1 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=in_app_purchase &rdid=0F7AB11F-DA50-498E-B225-21AC1977A85D &id_type=idfa &eea=1 &ad_personalization=0 &ad_user_data=1 &lat=0 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &value=1.99 ¤cy_code=USD Host: www.googleadservices.com User-Agent: MyAnalyticsCompany/1.0.0 (iOS 10.0.2; en_US; iPhone9,1; Build/13D15; Proxy) X-Forwarded-For: 216.58.194.174 Content-Type: application/json; charset=utf-8 ``` -------------------------------- ### GET /ad_events Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves ad conversion events including campaign details, network types, and attribution metadata. ```APIDOC ## GET /ad_events ### Description Retrieves a list of ad conversion events. The response structure varies based on whether the attribution is deterministic or non-deterministic, and includes specific geo and device information where applicable. ### Method GET ### Endpoint /ad_events ### Parameters #### Query Parameters - **network_type** (string) - Optional - The network type (e.g., YouTubeVideos, YouTubeSearch, VideoPartners, GoogleTvVideos, cross-network). ### Response #### Success Response (200) - **ad_events** (array) - List of ad event objects. - **attributed** (boolean) - Indicates if the conversion was successfully attributed. - **errors** (array) - List of error messages. #### Response Example { "ad_events": [{ "ad_event_id": "Q2owS0VRancwZHk0QlJDdXVMX2U1TQ", "conversion_metric": "conversion", "interaction_type": "engagement", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "is_deterministic": true, "timestamp": 1234567.898765 }], "errors": [], "attributed": true } ``` -------------------------------- ### Sample Deterministic Conversion Response (JSON) Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs An example JSON response for a deterministic conversion event in Google App Conversion Tracking. It includes details about the ad event, campaign, and attribution. ```json { "ad_events": [{ "ad_event_id": "Q2owS0VRancwZHk0QlJDdXVMX2U1TQ", "conversion_metric": "conversion", "interaction_type": "engagement", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "network_type": null, "network_subtype": null, "ad_group_id": null, "ad_group_name": null, "asset_group_id": null, "is_deterministic": true, "timestamp": 1234567.898765 }], "errors": [], "attributed": true } ``` -------------------------------- ### Get Android OS and Version for User-Agent Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the Android operating system and version to be included in the App User-Agent header. This is typically formatted as 'Android ' followed by the release version. ```java String osAndVersion = "Android " + Build.VERSION.RELEASE; ``` -------------------------------- ### Get App Version - iOS Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the short version string of the iOS application bundle. This is typically found in the app's Info.plist file. ```objectivec [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ``` -------------------------------- ### Fetch Aggregate Conversion Info in Swift Source: https://developers.google.com/app-conversion-tracking/api/integrated-conversion-measurement This Swift code fetches aggregate conversion information for installation events. It includes error handling and checks if any conversion data is available before printing it. This should be called shortly after app launch. ```swift ConversionManager.sharedInstance.fetchAggregateConversionInfo( for: .installation) { aggregateConversionInfo, error in guard error == nil else { return } guard let info = aggregateConversionInfo else { return } guard info.count > 0 else { return } print("Conversion info \(info)") } ``` -------------------------------- ### Get iOS OS and Version for User-Agent Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the iOS operating system and version for the App User-Agent header. It formats the output using the system name and system version properties of the current device. ```objective-c UIDevice *uid = [UIDevice currentDevice]; NSString *osAndVersion = [NSString stringWithFormat:@"%@ %@", [uid systemName], [uid systemVersion]]; ``` -------------------------------- ### Sample iOS Non-Deterministic Conversion Response (JSON) Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs An example JSON response for an iOS non-deterministic conversion event in Google App Conversion Tracking. It includes device information and attribution status. ```json { "ad_events": [{ "ad_event_id": "Q2owS0VRancwZHk0QlJDdXVMX2U1TQ", "conversion_metric": "conversion", "interaction_type": "engagement", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "network_type": null, "network_subtype": null, "ad_group_id": null, "ad_group_name": null, "asset_group_id": null, "is_deterministic": false, }, "device_info": { "device_model": "iphone12,3", "os_version": "14" }, "timestamp": 1432681918.123456 }], "errors": [], "attributed": true } ``` -------------------------------- ### Conversion Tracking Request Guide Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Details on how to send conversion tracking requests to Google Ads via HTTPS POST. This includes required and optional parameters necessary for notifying Google Ads of app events. ```APIDOC ## Conversion Tracking Request ### Description Conversion tracking requests are sent to `www.googleadservices.com` via HTTPS POST to notify Google Ads of app events for conversion tracking and remarketing. This includes various required and optional parameters. ### Method `POST` ### Endpoint `https://www.googleadservices.com/pagead/conversion/` ### Parameters #### Query Parameters - **dev_token** (string) - Required - Developer token for authentication. - **link_id** (string) - Required - Unique identifier for the conversion link. - **app_event_type** (string) - Required - Type of app event being tracked (e.g., 'purchase', 'install'). - **rdid** (string) - Required - Advertising ID of the device. - **id_type** (string) - Required - Type of the `rdid` (e.g., 'and` for Android Advertising ID, 'ios` for IDFA). - **lat** (integer) - Required - Limit Ad Tracking status (1 for limited, 0 for not limited). - **app_version** (string) - Required - Version of the app. - **os_version** (string) - Required - Version of the operating system. - **sdk_version** (string) - Required - Version of the SDK used. - **timestamp** (string) - Required - Timestamp of the event in ISO 8601 format. - **User-Agent** (string) - Required - The User-Agent header string. - **X-Forwarded-For** (string) - Required - The IP address of the user. #### Optional Query Parameters - **custom_data** (object) - Optional - Custom data associated with the event. - **value** (number) - Optional - The value of the conversion. - **currency** (string) - Optional - The currency of the conversion value. ### Request Example ```json { "dev_token": "YOUR_DEV_TOKEN", "link_id": "YOUR_LINK_ID", "app_event_type": "purchase", "rdid": "some_advertising_id", "id_type": "and", "lat": 0, "app_version": "1.0.0", "os_version": "10", "sdk_version": "1.2.3", "timestamp": "2023-10-27T10:00:00Z", "User-Agent": "name version (os_and_version; locale; device; build; Proxy)", "X-Forwarded-For": "192.168.1.1", "value": 19.99, "currency": "USD" } ``` ### Response #### Success Response (200) - **attributed** (boolean) - Indicates if the conversion was attributed. - **ad_event_id** (string) - The ID of the attributed ad event, if successful. #### Response Example ```json { "attributed": true, "ad_event_id": "event_abc123" } ``` #### Error Handling - The response may contain error or warning codes if the request is invalid or cannot be processed. ``` -------------------------------- ### Get Android Build ID for User-Agent Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Constructs the 'build' component for the App User-Agent header on Android, which is formatted as 'Build/' followed by the system's build ID. ```java String build = "Build/" + Build.ID; ``` -------------------------------- ### Add GoogleAdsOnDeviceConversion Pod to Podfile Source: https://developers.google.com/app-conversion-tracking/api/integrated-conversion-measurement This snippet shows how to add the GoogleAdsOnDeviceConversion pod to your project's Podfile for integration using CocoaPods. Ensure you run `pod install --repo-update` after modifying the Podfile. ```ruby pod 'GoogleAdsOnDeviceConversion' ``` -------------------------------- ### Sample Android Non-Deterministic Conversion Response (JSON) Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs An example JSON response for an Android non-deterministic conversion event in Google App Conversion Tracking. It includes geo-location, device information, and attribution status. ```json { "ad_events": [ { "ad_event_id": "Q2owS0VRancwZHk0QlJDdXVMX2U1TQ", "conversion_metric": "conversion", "interaction_type": "click", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "network_type": null, "network_subtype": null, "ad_group_id": null, "ad_group_name": null, "asset_group_id": null, "is_deterministic": false, "geo_info": { "city": "san jose", "country": "US", "region": "california" }, "device_info": { "device_model": "sm-s926u", "os_version": "14" }, "timestamp": 1432681918.123456 }, ], "errors": [], "warnings": [] } } ``` -------------------------------- ### Attributed Conversion Tracking Response (Consent Denied) Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs This example shows an attributed conversion tracking response where the conversion is attributed to both Play and Search ad interactions, but cross-use consent is denied between the Play and Search CPSs. ```APIDOC ## GET /websites/developers_google_app-conversion-tracking ### Description Retrieves attributed conversion tracking data for app interactions, considering consent settings. ### Method GET ### Endpoint /websites/developers_google_app-conversion-tracking ### Parameters #### Query Parameters - **consent_status** (string) - Required - Specifies the cross-use consent status between CPSs (e.g., 'denied', 'accepted'). - **interaction_types** (string) - Optional - Comma-separated list of interaction types to filter by (e.g., 'click', 'view'). ### Response #### Success Response (200) - **ad_events** (array) - A list of ad events that contributed to the conversion. - **ad_event_id** (string) - Unique identifier for the ad event. - **conversion_metric** (string) - The metric used for conversion (e.g., 'conversion'). - **interaction_type** (string) - The type of interaction (e.g., 'click'). - **campaign_type** (string) - The type of campaign (e.g., 'ACI'). - **campaign_id** (integer) - The ID of the campaign. - **campaign_name** (string) - The name of the campaign. - **ad_type** (string) - The type of ad. - **external_customer_id** (integer) - The external customer ID. - **location** (integer) - The location ID. - **network_type** (string) - The network type (e.g., 'Display', 'Search'). - **network_subtype** (string) - The subtype of the network. - **video_id** (string) - The ID of the video, if applicable. - **keyword** (string) - The keyword used, if applicable. - **match_type** (string) - The match type of the keyword. - **placement** (string) - The ad placement. - **ad_group_id** (integer) - The ID of the ad group. - **ad_group_name** (string) - The name of the ad group. - **asset_group_id** (integer) - The ID of the asset group. - **creative_id** (integer) - The ID of the creative. - **timestamp** (float) - The Unix timestamp of the event. - **errors** (array) - A list of errors encountered during the request. - **warnings** (array) - A list of warnings encountered during the request. - **attributed** (boolean) - Indicates if the conversion was attributed. #### Response Example ```json { "ad_events": [ { "ad_event_id": "Q2owS0VRancwZHk0QlJDdXVMX2U1TQ", "conversion_metric": "conversion", "interaction_type": "click", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "ad_type": "ClickToDownload", "external_customer_id": 123456789, "location": 21144, "network_type": "Display", "network_subtype": "", "video_id": null, "keyword": null, "match_type": null, "placement": null, "ad_group_id": null, "ad_group_name": "", "asset_group_id": null, "creative_id": null, "timestamp": 1432681913.123456 }, { "ad_event_id": "I8YUwWqxvOyqcwOcqBAkYZBMaOONSd", "conversion_metric": "conversion", "interaction_type": "click", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "ad_type": "ClickToDownload", "external_customer_id": 123456789, "location": 21144, "network_type": "Search", "network_subtype": "", "video_id": null, "keyword": null, "match_type": null, "placement": null, "ad_group_id": null, "ad_group_name": "", "asset_group_id": null, "creative_id": null, "timestamp": 1432681913.123456 } ], "errors": [], "warnings": [], "attributed": true } ``` ``` -------------------------------- ### App Conversion Tracking: Deeplink Session with Advertising ID Source: https://developers.google.com/app-conversion-tracking/api/privacy-compliant-guide This snippet illustrates a 'session_start' event for a deeplink-driven session when the advertising ID is available. It includes both `gclid` and `market_referrer_gclid` for accurate attribution of installs originating from deeplinks. ```http POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=session_start &rdid=0F7AB11F-DA50-498E-B225-21AC1977A85D &id_type=advertisingid &eea=0 &lat=0 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &market_referrer_gclid=BX3QojHp4mY5MrJtFM_d1u &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O ``` -------------------------------- ### Attributed Conversion Tracking Response (Mixed Consent) Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs This example shows an attributed conversion tracking response where the conversion is attributed to Play, Search, and YouTube ad interactions. Cross-use consent is accepted between Play and Search CPSs but denied to the YouTube CPS. ```APIDOC ## GET /websites/developers_google_app-conversion-tracking ### Description Retrieves attributed conversion tracking data for app interactions, considering consent settings. ### Method GET ### Endpoint /websites/developers_google_app-conversion-tracking ### Parameters #### Query Parameters - **consent_status** (string) - Required - Specifies the cross-use consent status between CPSs (e.g., 'denied', 'accepted'). - **interaction_types** (string) - Optional - Comma-separated list of interaction types to filter by (e.g., 'click', 'view'). ### Response #### Success Response (200) - **ad_events** (array) - A list of ad events that contributed to the conversion. - **ad_event_id** (string) - Unique identifier for the ad event. - **conversion_metric** (string) - The metric used for conversion (e.g., 'conversion'). - **interaction_type** (string) - The type of interaction (e.g., 'click'). - **campaign_type** (string) - The type of campaign (e.g., 'ACI'). - **campaign_id** (integer) - The ID of the campaign. - **campaign_name** (string) - The name of the campaign. - **ad_type** (string) - The type of ad. - **external_customer_id** (integer) - The external customer ID. - **location** (integer) - The location ID. - **network_type** (string) - The network type (e.g., 'Display', 'Search', 'YouTube'). - **network_subtype** (string) - The subtype of the network. - **video_id** (string) - The ID of the video, if applicable. - **keyword** (string) - The keyword used, if applicable. - **match_type** (string) - The match type of the keyword. - **placement** (string) - The ad placement. - **ad_group_id** (integer) - The ID of the ad group. - **ad_group_name** (string) - The name of the ad group. - **asset_group_id** (integer) - The ID of the asset group. - **creative_id** (integer) - The ID of the creative. - **timestamp** (float) - The Unix timestamp of the event. - **errors** (array) - A list of errors encountered during the request. - **warnings** (array) - A list of warnings encountered during the request. - **attributed** (boolean) - Indicates if the conversion was attributed. #### Response Example ```json { "ad_events": [ { "ad_event_id": "Q2owS0VRancwZHk0QlJDdXVMX2U1TQ", "conversion_metric": "conversion", "interaction_type": "click", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "ad_type": "ClickToDownload", "external_customer_id": 123456789, "location": 21144, "network_type": "Display", "network_subtype": "", "video_id": null, "keyword": null, "match_type": null, "placement": null, "ad_group_id": null, "ad_group_name": "", "asset_group_id": null, "creative_id": null, "timestamp": 1432681913.123456 }, { "ad_event_id": "I8YUwWqxvOyqcwOcqBAkYZBMaOONSd", "conversion_metric": "conversion", "interaction_type": "click", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "ad_type": "ClickToDownload", "external_customer_id": 123456789, "location": 21144, "network_type": "YouTube", "network_subtype": "YouTubeVideos", "video_id": null, "keyword": null, "match_type": null, "placement": null, "ad_group_id": null, "ad_group_name": "", "asset_group_id": null, "creative_id": null, "timestamp": 1432681913.123456 } ], "errors": [], "warnings": [], "attributed": true } ``` ``` -------------------------------- ### Attributed Conversion Tracking Response (Consent Accepted) Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs This example shows an attributed conversion tracking response where the conversion is attributed to both Play and Search ad interactions, and cross-use consent is accepted between the Play and Search CPSs, similar to today's conversion behavior. ```APIDOC ## GET /websites/developers_google_app-conversion-tracking ### Description Retrieves attributed conversion tracking data for app interactions, considering consent settings. ### Method GET ### Endpoint /websites/developers_google_app-conversion-tracking ### Parameters #### Query Parameters - **consent_status** (string) - Required - Specifies the cross-use consent status between CPSs (e.g., 'denied', 'accepted'). - **interaction_types** (string) - Optional - Comma-separated list of interaction types to filter by (e.g., 'click', 'view'). ### Response #### Success Response (200) - **ad_events** (array) - A list of ad events that contributed to the conversion. - **ad_event_id** (string) - Unique identifier for the ad event. - **conversion_metric** (string) - The metric used for conversion (e.g., 'conversion'). - **interaction_type** (string) - The type of interaction (e.g., 'click'). - **campaign_type** (string) - The type of campaign (e.g., 'ACI'). - **campaign_id** (integer) - The ID of the campaign. - **campaign_name** (string) - The name of the campaign. - **ad_type** (string) - The type of ad. - **external_customer_id** (integer) - The external customer ID. - **location** (integer) - The location ID. - **network_type** (string) - The network type (e.g., 'Display', 'Search'). - **network_subtype** (string) - The subtype of the network. - **video_id** (string) - The ID of the video, if applicable. - **keyword** (string) - The keyword used, if applicable. - **match_type** (string) - The match type of the keyword. - **placement** (string) - The ad placement. - **ad_group_id** (integer) - The ID of the ad group. - **ad_group_name** (string) - The name of the ad group. - **asset_group_id** (integer) - The ID of the asset group. - **creative_id** (integer) - The ID of the creative. - **timestamp** (float) - The Unix timestamp of the event. - **errors** (array) - A list of errors encountered during the request. - **warnings** (array) - A list of warnings encountered during the request. - **attributed** (boolean) - Indicates if the conversion was attributed. #### Response Example ```json { "ad_events": [ { "ad_event_id": "Q2owS0VRancwZHk0QlJDdXVMX2U1TQ", "conversion_metric": "conversion", "interaction_type": "click", "campaign_type": "ACI", "campaign_id": 123456789, "campaign_name": "My App Campaign", "ad_type": "ClickToDownload", "external_customer_id": 123456789, "location": 21144, "network_type": "Display", "network_subtype": "", "video_id": null, "keyword": null, "match_type": null, "placement": null, "ad_group_id": null, "ad_group_name": "", "asset_group_id": null, "creative_id": null, "timestamp": 1432681913.123456 } ], "errors": [], "warnings": [], "attributed": true } ``` ``` -------------------------------- ### Report App Conversion Events via HTTP POST Source: https://developers.google.com/app-conversion-tracking/api/privacy-compliant-guide Demonstrates how to send app conversion events such as in-app purchases and session starts to the Google conversion tracking endpoint. These requests include essential metadata like dev_token, link_id, and device identifiers. ```HTTP POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=in_app_purchase &rdid=0F7AB11F-DA50-498E-B225-21AC1977A85D &id_type=idfa &eea=0 &lat=0 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O ``` ```HTTP POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=session_start &rdid=0F7AB11F-DA50-498E-B225-21AC1977A85D &id_type=idfa &eea=0 &lat=0 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O &app_open_source=organic ``` -------------------------------- ### Initialize and Fetch Conversion Info with GoogleAdsOnDeviceConversion Source: https://developers.google.com/app-conversion-tracking/api/integrated-conversion-measurement This snippet demonstrates how to import the SDK, set the application's first launch time, and fetch aggregate conversion information. The resulting string is used as the odm_info query parameter in the App Conversion API. ```Objective-C @import GoogleAdsOnDeviceConversion; [[ODCConversionManager sharedInstance] setFirstLaunchTime:[NSDate date]]; [[ODCConversionManager sharedInstance] fetchAggregateConversionInfoForInteraction:ODCInteractionTypeInstallation completion:^(NSString * _Nullable aggregateConversionInfo, NSError * _Nullable error) { if (error) { return; } if (aggregateConversionInfo.length == 0) { return; } NSLog(@"Conversion info %@", aggregateConversionInfo); }]; ``` -------------------------------- ### Get OS Version - Android Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the release version of the Android operating system. This provides the user-facing OS version number. ```java android.os.Build.VERSION.RELEASE ``` -------------------------------- ### Set First Launch Time in Swift Source: https://developers.google.com/app-conversion-tracking/api/integrated-conversion-measurement This Swift code snippet shows how to set the application's first launch time using the ConversionManager. This is crucial for accurate conversion tracking, especially for the `first_open` event. ```swift ConversionManager.sharedInstance.setFirstLaunchTime(Date()) ``` -------------------------------- ### Import GoogleAdsOnDeviceConversion SDK in Swift Source: https://developers.google.com/app-conversion-tracking/api/integrated-conversion-measurement This code demonstrates how to import the necessary GoogleAdsOnDeviceConversion framework in your Swift project. This is a prerequisite for using the ODM SDK's functionalities. ```swift import GoogleAdsOnDeviceConversion ``` -------------------------------- ### Get App Version - Android Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the current version name of the Android application package. This requires access to the package manager and package information. ```java packageManager.getPackageInfo(packageName(), PackageManager.GET_META_DATA).versionName ``` -------------------------------- ### Construct App User-Agent Header Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Defines the structure of the App User-Agent header used by analytics/ads products. It includes fields for the product name, version, OS and version, locale, device name, and build number. The 'name' field should be the bundle ID of the client app if constructed on the client side. ```string name version (os_and_version; locale; device; build; Proxy) ``` -------------------------------- ### Get Android Device Model for User-Agent Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Fetches the model name of the Android device, such as 'Pixel 5'. This is used in the 'device' component of the App User-Agent header. ```java String device = Build.MODEL; ``` -------------------------------- ### Get iOS System Version Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the system version of the iOS device. This is often used to provide context for SDK versioning when an app does not use a specific SDK. ```objectivec [[UIDevice currentDevice] systemVersion] ``` -------------------------------- ### App Conversion Tracking: Subsequent/Organic Session Source: https://developers.google.com/app-conversion-tracking/api/privacy-compliant-guide This snippet shows how to log a 'session_start' event for subsequent or organic app sessions. It includes essential parameters for tracking user engagement and session data. This is distinct from initial deeplink-driven sessions. ```http POST /pagead/conversion/app/1.0 ?dev_token=Z_eErE4DkvcKjDM1OVE4c4 &link_id=31FF8D67E5BB5DD5029DCC2734C2F884 &app_event_type=session_start &rdid=00000000-0000-0000-0000-000000000000 &id_type=advertisingid &eea=0 &lat=1 &app_version=1.2.4 &os_version=9.3.2 &sdk_version=1.9.5r6 ×tamp=1432681913.123456 &gclid=Cj0KEQjw0dy4BRCuuL_e5M &gclid_only_request=1 &gbraid=ChEI8IixhgYQrufHkIjz3YWRARIzALev_G_O ``` -------------------------------- ### Get Current Locale for iOS User-Agent Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the current locale identifier for an iOS device, formatted as an IETF locale tag. This information is included in the App User-Agent header. ```objective-c NSString *locale = [[NSLocale currentLocale] localeIdentifier] ``` -------------------------------- ### Get iOS Device Model for User-Agent Source: https://developers.google.com/app-conversion-tracking/api/request-response-specs Retrieves the hardware model identifier for an iOS device (e.g., 'iPhone9,1') using `sysctlbyname`. This is crucial for the 'device' field in the App User-Agent header. ```objective-c @import Darwin.sys.sysctl; NSString *device(void) { size_t bufferSize = 64; NSMutableData *buffer = [[NSMutableData alloc] initWithLength:bufferSize]; int status = sysctlbyname("hw.machine", buffer.mutableBytes, &bufferSize, NULL, 0); if (status != 0) { return nil; } return [[NSString alloc] initWithCString:buffer.mutableBytes encoding:NSUTF8StringEncoding]; } ```