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