1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.ads.googleads.v16.services; 18 19import "google/ads/googleads/v16/common/consent.proto"; 20import "google/ads/googleads/v16/common/offline_user_data.proto"; 21import "google/ads/googleads/v16/enums/conversion_environment_enum.proto"; 22import "google/api/annotations.proto"; 23import "google/api/client.proto"; 24import "google/api/field_behavior.proto"; 25import "google/api/resource.proto"; 26import "google/rpc/status.proto"; 27 28option csharp_namespace = "Google.Ads.GoogleAds.V16.Services"; 29option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v16/services;services"; 30option java_multiple_files = true; 31option java_outer_classname = "ConversionUploadServiceProto"; 32option java_package = "com.google.ads.googleads.v16.services"; 33option objc_class_prefix = "GAA"; 34option php_namespace = "Google\\Ads\\GoogleAds\\V16\\Services"; 35option ruby_package = "Google::Ads::GoogleAds::V16::Services"; 36 37// Service to upload conversions. 38service ConversionUploadService { 39 option (google.api.default_host) = "googleads.googleapis.com"; 40 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/adwords"; 41 42 // Processes the given click conversions. 43 // 44 // List of thrown errors: 45 // [AuthenticationError]() 46 // [AuthorizationError]() 47 // [ConversionUploadError]() 48 // [HeaderError]() 49 // [InternalError]() 50 // [PartialFailureError]() 51 // [QuotaError]() 52 // [RequestError]() 53 rpc UploadClickConversions(UploadClickConversionsRequest) 54 returns (UploadClickConversionsResponse) { 55 option (google.api.http) = { 56 post: "/v16/customers/{customer_id=*}:uploadClickConversions" 57 body: "*" 58 }; 59 option (google.api.method_signature) = 60 "customer_id,conversions,partial_failure"; 61 } 62 63 // Processes the given call conversions. 64 // 65 // List of thrown errors: 66 // [AuthenticationError]() 67 // [AuthorizationError]() 68 // [HeaderError]() 69 // [InternalError]() 70 // [PartialFailureError]() 71 // [QuotaError]() 72 // [RequestError]() 73 rpc UploadCallConversions(UploadCallConversionsRequest) 74 returns (UploadCallConversionsResponse) { 75 option (google.api.http) = { 76 post: "/v16/customers/{customer_id=*}:uploadCallConversions" 77 body: "*" 78 }; 79 option (google.api.method_signature) = 80 "customer_id,conversions,partial_failure"; 81 } 82} 83 84// Request message for 85// [ConversionUploadService.UploadClickConversions][google.ads.googleads.v16.services.ConversionUploadService.UploadClickConversions]. 86message UploadClickConversionsRequest { 87 // Required. The ID of the customer performing the upload. 88 string customer_id = 1 [(google.api.field_behavior) = REQUIRED]; 89 90 // Required. The conversions that are being uploaded. 91 repeated ClickConversion conversions = 2 92 [(google.api.field_behavior) = REQUIRED]; 93 94 // Required. If true, successful operations will be carried out and invalid 95 // operations will return errors. If false, all operations will be carried 96 // out in one transaction if and only if they are all valid. 97 // This should always be set to true. 98 // See 99 // https://developers.google.com/google-ads/api/docs/best-practices/partial-failures 100 // for more information about partial failure. 101 bool partial_failure = 3 [(google.api.field_behavior) = REQUIRED]; 102 103 // If true, the request is validated but not executed. Only errors are 104 // returned, not results. 105 bool validate_only = 4; 106 107 // If true, the API will perform all upload checks and return errors if 108 // any are found. If false, it will perform only basic input validation, 109 // skip subsequent upload checks, and return success even if no click 110 // was found for the provided `user_identifiers`. 111 // 112 // This setting only affects Enhanced conversions for leads uploads that use 113 // `user_identifiers` instead of `GCLID`, `GBRAID`, or `WBRAID`. When 114 // uploading enhanced conversions for leads, you should upload all conversion 115 // events to the API, including those that may not come from Google Ads 116 // campaigns. The upload of an event that is not from a Google Ads campaign 117 // will result in a `CLICK_NOT_FOUND` error if this field is set to `true`. 118 // Since these errors are expected for such events, set this field to `false` 119 // so you can confirm your uploads are properly formatted but ignore 120 // `CLICK_NOT_FOUND` errors from all of the conversions that are not from a 121 // Google Ads campaign. This will allow you to focus only on errors that you 122 // can address. 123 // 124 // Default is false. 125 bool debug_enabled = 5; 126 127 // Optional. Optional input to set job ID. Must be a non-negative number that 128 // is less than 2^31 if provided. If this field is not provided, the API will 129 // generate a job ID in the range [2^31, (2^63)-1]. The API will return the 130 // value for this request in the `job_id` field of the 131 // `UploadClickConversionsResponse`. 132 optional int32 job_id = 6 [(google.api.field_behavior) = OPTIONAL]; 133} 134 135// Response message for 136// [ConversionUploadService.UploadClickConversions][google.ads.googleads.v16.services.ConversionUploadService.UploadClickConversions]. 137message UploadClickConversionsResponse { 138 // Errors that pertain to conversion failures in the partial failure mode. 139 // Returned when all errors occur inside the conversions. If any errors occur 140 // outside the conversions (for example, auth errors), we return an RPC level 141 // error. See 142 // https://developers.google.com/google-ads/api/docs/best-practices/partial-failures 143 // for more information about partial failure. 144 google.rpc.Status partial_failure_error = 1; 145 146 // Returned for successfully processed conversions. Proto will be empty for 147 // rows that received an error. Results are not returned when validate_only is 148 // true. 149 repeated ClickConversionResult results = 2; 150 151 // Job ID for the upload batch. 152 int64 job_id = 3; 153} 154 155// Request message for 156// [ConversionUploadService.UploadCallConversions][google.ads.googleads.v16.services.ConversionUploadService.UploadCallConversions]. 157message UploadCallConversionsRequest { 158 // Required. The ID of the customer performing the upload. 159 string customer_id = 1 [(google.api.field_behavior) = REQUIRED]; 160 161 // Required. The conversions that are being uploaded. 162 repeated CallConversion conversions = 2 163 [(google.api.field_behavior) = REQUIRED]; 164 165 // Required. If true, successful operations will be carried out and invalid 166 // operations will return errors. If false, all operations will be carried 167 // out in one transaction if and only if they are all valid. 168 // This should always be set to true. 169 // See 170 // https://developers.google.com/google-ads/api/docs/best-practices/partial-failures 171 // for more information about partial failure. 172 bool partial_failure = 3 [(google.api.field_behavior) = REQUIRED]; 173 174 // If true, the request is validated but not executed. Only errors are 175 // returned, not results. 176 bool validate_only = 4; 177} 178 179// Response message for 180// [ConversionUploadService.UploadCallConversions][google.ads.googleads.v16.services.ConversionUploadService.UploadCallConversions]. 181message UploadCallConversionsResponse { 182 // Errors that pertain to conversion failures in the partial failure mode. 183 // Returned when all errors occur inside the conversions. If any errors occur 184 // outside the conversions (for example, auth errors), we return an RPC level 185 // error. See 186 // https://developers.google.com/google-ads/api/docs/best-practices/partial-failures 187 // for more information about partial failure. 188 google.rpc.Status partial_failure_error = 1; 189 190 // Returned for successfully processed conversions. Proto will be empty for 191 // rows that received an error. Results are not returned when validate_only is 192 // true. 193 repeated CallConversionResult results = 2; 194} 195 196// A click conversion. 197message ClickConversion { 198 // The Google click ID (gclid) associated with this conversion. 199 optional string gclid = 9; 200 201 // The click identifier for clicks associated with app conversions and 202 // originating from iOS devices starting with iOS14. 203 string gbraid = 18; 204 205 // The click identifier for clicks associated with web conversions and 206 // originating from iOS devices starting with iOS14. 207 string wbraid = 19; 208 209 // Resource name of the conversion action associated with this conversion. 210 // Note: Although this resource name consists of a customer id and a 211 // conversion action id, validation will ignore the customer id and use the 212 // conversion action id as the sole identifier of the conversion action. 213 optional string conversion_action = 10; 214 215 // The date time at which the conversion occurred. Must be after 216 // the click time. The timezone must be specified. The format is 217 // "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 218 optional string conversion_date_time = 11; 219 220 // The value of the conversion for the advertiser. 221 optional double conversion_value = 12; 222 223 // Currency associated with the conversion value. This is the ISO 4217 224 // 3-character currency code. For example: USD, EUR. 225 optional string currency_code = 13; 226 227 // The order ID associated with the conversion. An order id can only be used 228 // for one conversion per conversion action. 229 optional string order_id = 14; 230 231 // Additional data about externally attributed conversions. This field 232 // is required for conversions with an externally attributed conversion 233 // action, but should not be set otherwise. 234 ExternalAttributionData external_attribution_data = 7; 235 236 // The custom variables associated with this conversion. 237 repeated CustomVariable custom_variables = 15; 238 239 // The cart data associated with this conversion. 240 CartData cart_data = 16; 241 242 // The user identifiers associated with this conversion. Only hashed_email and 243 // hashed_phone_number are supported for conversion uploads. The maximum 244 // number of user identifiers for each conversion is 5. 245 repeated google.ads.googleads.v16.common.UserIdentifier user_identifiers = 17; 246 247 // The environment this conversion was recorded on, for example, App or Web. 248 google.ads.googleads.v16.enums.ConversionEnvironmentEnum.ConversionEnvironment 249 conversion_environment = 20; 250 251 // The consent setting for the event. 252 google.ads.googleads.v16.common.Consent consent = 23; 253} 254 255// A call conversion. 256message CallConversion { 257 // The caller id from which this call was placed. Caller id is expected to be 258 // in E.164 format with preceding '+' sign, for example, "+16502531234". 259 optional string caller_id = 7; 260 261 // The date time at which the call occurred. The timezone must be specified. 262 // The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", 263 // for example, "2019-01-01 12:32:45-08:00". 264 optional string call_start_date_time = 8; 265 266 // Resource name of the conversion action associated with this conversion. 267 // Note: Although this resource name consists of a customer id and a 268 // conversion action id, validation will ignore the customer id and use the 269 // conversion action id as the sole identifier of the conversion action. 270 optional string conversion_action = 9; 271 272 // The date time at which the conversion occurred. Must be after the call 273 // time. The timezone must be specified. The format is 274 // "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 275 optional string conversion_date_time = 10; 276 277 // The value of the conversion for the advertiser. 278 optional double conversion_value = 11; 279 280 // Currency associated with the conversion value. This is the ISO 4217 281 // 3-character currency code. For example: USD, EUR. 282 optional string currency_code = 12; 283 284 // The custom variables associated with this conversion. 285 repeated CustomVariable custom_variables = 13; 286 287 // The consent setting for the event. 288 google.ads.googleads.v16.common.Consent consent = 14; 289} 290 291// Contains additional information about externally attributed conversions. 292message ExternalAttributionData { 293 // Represents the fraction of the conversion that is attributed to the 294 // Google Ads click. 295 optional double external_attribution_credit = 3; 296 297 // Specifies the attribution model name. 298 optional string external_attribution_model = 4; 299} 300 301// Identifying information for a successfully processed ClickConversion. 302message ClickConversionResult { 303 // The Google Click ID (gclid) associated with this conversion. 304 optional string gclid = 4; 305 306 // The click identifier for clicks associated with app conversions and 307 // originating from iOS devices starting with iOS14. 308 string gbraid = 8; 309 310 // The click identifier for clicks associated with web conversions and 311 // originating from iOS devices starting with iOS14. 312 string wbraid = 9; 313 314 // Resource name of the conversion action associated with this conversion. 315 optional string conversion_action = 5; 316 317 // The date time at which the conversion occurred. The format is 318 // "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 319 optional string conversion_date_time = 6; 320 321 // The user identifiers associated with this conversion. Only hashed_email and 322 // hashed_phone_number are supported for conversion uploads. The maximum 323 // number of user identifiers for each conversion is 5. 324 repeated google.ads.googleads.v16.common.UserIdentifier user_identifiers = 7; 325} 326 327// Identifying information for a successfully processed CallConversionUpload. 328message CallConversionResult { 329 // The caller id from which this call was placed. Caller id is expected to be 330 // in E.164 format with preceding '+' sign. 331 optional string caller_id = 5; 332 333 // The date time at which the call occurred. The format is 334 // "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 335 optional string call_start_date_time = 6; 336 337 // Resource name of the conversion action associated with this conversion. 338 optional string conversion_action = 7; 339 340 // The date time at which the conversion occurred. The format is 341 // "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 342 optional string conversion_date_time = 8; 343} 344 345// A custom variable. 346message CustomVariable { 347 // Resource name of the custom variable associated with this conversion. 348 // Note: Although this resource name consists of a customer id and a 349 // conversion custom variable id, validation will ignore the customer id and 350 // use the conversion custom variable id as the sole identifier of the 351 // conversion custom variable. 352 string conversion_custom_variable = 1 [(google.api.resource_reference) = { 353 type: "googleads.googleapis.com/ConversionCustomVariable" 354 }]; 355 356 // The value string of this custom variable. 357 // The value of the custom variable should not contain private customer data, 358 // such as email addresses or phone numbers. 359 string value = 2; 360} 361 362// Contains additional information about cart data. 363message CartData { 364 // Contains data of the items purchased. 365 message Item { 366 // The shopping id of the item. Must be equal to the Merchant Center product 367 // identifier. 368 string product_id = 1; 369 370 // Number of items sold. 371 int32 quantity = 2; 372 373 // Unit price excluding tax, shipping, and any transaction 374 // level discounts. The currency code is the same as that in the 375 // ClickConversion message. 376 double unit_price = 3; 377 } 378 379 // The Merchant Center ID where the items are uploaded. 380 int64 merchant_id = 6; 381 382 // The country code associated with the feed where the items are uploaded. 383 string feed_country_code = 2; 384 385 // The language code associated with the feed where the items are uploaded. 386 string feed_language_code = 3; 387 388 // Sum of all transaction level discounts, such as free shipping and 389 // coupon discounts for the whole cart. The currency code is the same 390 // as that in the ClickConversion message. 391 double local_transaction_cost = 4; 392 393 // Data of the items purchased. 394 repeated Item items = 5; 395} 396