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/offline_user_data.proto"; 20import "google/ads/googleads/v16/enums/conversion_adjustment_type.proto"; 21import "google/api/annotations.proto"; 22import "google/api/client.proto"; 23import "google/api/field_behavior.proto"; 24import "google/rpc/status.proto"; 25 26option csharp_namespace = "Google.Ads.GoogleAds.V16.Services"; 27option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v16/services;services"; 28option java_multiple_files = true; 29option java_outer_classname = "ConversionAdjustmentUploadServiceProto"; 30option java_package = "com.google.ads.googleads.v16.services"; 31option objc_class_prefix = "GAA"; 32option php_namespace = "Google\\Ads\\GoogleAds\\V16\\Services"; 33option ruby_package = "Google::Ads::GoogleAds::V16::Services"; 34 35// Service to upload conversion adjustments. 36service ConversionAdjustmentUploadService { 37 option (google.api.default_host) = "googleads.googleapis.com"; 38 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/adwords"; 39 40 // Processes the given conversion adjustments. 41 // 42 // List of thrown errors: 43 // [AuthenticationError]() 44 // [AuthorizationError]() 45 // [HeaderError]() 46 // [InternalError]() 47 // [PartialFailureError]() 48 // [QuotaError]() 49 // [RequestError]() 50 rpc UploadConversionAdjustments(UploadConversionAdjustmentsRequest) 51 returns (UploadConversionAdjustmentsResponse) { 52 option (google.api.http) = { 53 post: "/v16/customers/{customer_id=*}:uploadConversionAdjustments" 54 body: "*" 55 }; 56 option (google.api.method_signature) = 57 "customer_id,conversion_adjustments,partial_failure"; 58 } 59} 60 61// Request message for 62// [ConversionAdjustmentUploadService.UploadConversionAdjustments][google.ads.googleads.v16.services.ConversionAdjustmentUploadService.UploadConversionAdjustments]. 63message UploadConversionAdjustmentsRequest { 64 // Required. The ID of the customer performing the upload. 65 string customer_id = 1 [(google.api.field_behavior) = REQUIRED]; 66 67 // Required. The conversion adjustments that are being uploaded. 68 repeated ConversionAdjustment conversion_adjustments = 2 69 [(google.api.field_behavior) = REQUIRED]; 70 71 // Required. If true, successful operations will be carried out and invalid 72 // operations will return errors. If false, all operations will be carried out 73 // in one transaction if and only if they are all valid. This should always be 74 // set to true. 75 // See 76 // https://developers.google.com/google-ads/api/docs/best-practices/partial-failures 77 // for more information about partial failure. 78 bool partial_failure = 3 [(google.api.field_behavior) = REQUIRED]; 79 80 // If true, the request is validated but not executed. Only errors are 81 // returned, not results. 82 bool validate_only = 4; 83 84 // Optional. Optional input to set job ID. Must be a non-negative number that 85 // is less than 2^31 if provided. If this field is not provided, the API will 86 // generate a job ID in the range [2^31, (2^63)-1]. The API will return the 87 // value for this request in the `job_id` field of the 88 // `UploadConversionAdjustmentsResponse`. 89 optional int32 job_id = 5 [(google.api.field_behavior) = OPTIONAL]; 90} 91 92// Response message for 93// [ConversionAdjustmentUploadService.UploadConversionAdjustments][google.ads.googleads.v16.services.ConversionAdjustmentUploadService.UploadConversionAdjustments]. 94message UploadConversionAdjustmentsResponse { 95 // Errors that pertain to conversion adjustment failures in the partial 96 // failure mode. Returned when all errors occur inside the adjustments. If any 97 // errors occur outside the adjustments (for example, auth errors), we return 98 // an RPC level error. See 99 // https://developers.google.com/google-ads/api/docs/best-practices/partial-failures 100 // for more information about partial failure. 101 google.rpc.Status partial_failure_error = 1; 102 103 // Returned for successfully processed conversion adjustments. Proto will be 104 // empty for rows that received an error. Results are not returned when 105 // validate_only is true. 106 repeated ConversionAdjustmentResult results = 2; 107 108 // Job ID for the upload batch. 109 int64 job_id = 3; 110} 111 112// A conversion adjustment. 113message ConversionAdjustment { 114 // For adjustments, uniquely identifies a conversion that was reported 115 // without an order ID specified. If the adjustment_type is ENHANCEMENT, this 116 // value is optional but may be set in addition to the order_id. 117 GclidDateTimePair gclid_date_time_pair = 12; 118 119 // The order ID of the conversion to be adjusted. If the conversion was 120 // reported with an order ID specified, that order ID must be used as the 121 // identifier here. The order ID is required for enhancements. 122 optional string order_id = 13; 123 124 // Resource name of the conversion action associated with this conversion 125 // adjustment. Note: Although this resource name consists of a customer id and 126 // a conversion action id, validation will ignore the customer id and use the 127 // conversion action id as the sole identifier of the conversion action. 128 optional string conversion_action = 8; 129 130 // The date time at which the adjustment occurred. Must be after the 131 // conversion_date_time. The timezone must be specified. The format is 132 // "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 133 optional string adjustment_date_time = 9; 134 135 // The adjustment type. 136 google.ads.googleads.v16.enums.ConversionAdjustmentTypeEnum 137 .ConversionAdjustmentType adjustment_type = 5; 138 139 // Information needed to restate the conversion's value. 140 // Required for restatements. Should not be supplied for retractions. An error 141 // will be returned if provided for a retraction. 142 // NOTE: If you want to upload a second restatement with a different adjusted 143 // value, it must have a new, more recent, adjustment occurrence time. 144 // Otherwise, it will be treated as a duplicate of the previous restatement 145 // and ignored. 146 RestatementValue restatement_value = 6; 147 148 // The user identifiers to enhance the original conversion. 149 // ConversionAdjustmentUploadService only accepts user identifiers in 150 // enhancements. The maximum number of user identifiers for each 151 // enhancement is 5. 152 repeated google.ads.googleads.v16.common.UserIdentifier user_identifiers = 10; 153 154 // The user agent to enhance the original conversion. This can be found in 155 // your user's HTTP request header when they convert on your web page. 156 // Example, "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X)". User 157 // agent can only be specified in enhancements with user identifiers. This 158 // should match the user agent of the request that sent the original 159 // conversion so the conversion and its enhancement are either both attributed 160 // as same-device or both attributed as cross-device. 161 optional string user_agent = 11; 162} 163 164// Contains information needed to restate a conversion's value. 165message RestatementValue { 166 // The restated conversion value. This is the value of the conversion after 167 // restatement. For example, to change the value of a conversion from 100 to 168 // 70, an adjusted value of 70 should be reported. 169 // NOTE: If you want to upload a second restatement with a different adjusted 170 // value, it must have a new, more recent, adjustment occurrence time. 171 // Otherwise, it will be treated as a duplicate of the previous restatement 172 // and ignored. 173 optional double adjusted_value = 3; 174 175 // The currency of the restated value. If not provided, then the default 176 // currency from the conversion action is used, and if that is not set then 177 // the account currency is used. This is the ISO 4217 3-character currency 178 // code for example, USD or EUR. 179 optional string currency_code = 4; 180} 181 182// Uniquely identifies a conversion that was reported without an order ID 183// specified. 184message GclidDateTimePair { 185 // Google click ID (gclid) associated with the original conversion for this 186 // adjustment. 187 optional string gclid = 3; 188 189 // The date time at which the original conversion for this adjustment 190 // occurred. The timezone must be specified. The format is "yyyy-mm-dd 191 // hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 192 optional string conversion_date_time = 4; 193} 194 195// Information identifying a successfully processed ConversionAdjustment. 196message ConversionAdjustmentResult { 197 // The gclid and conversion date time of the conversion. 198 GclidDateTimePair gclid_date_time_pair = 9; 199 200 // The order ID of the conversion to be adjusted. 201 string order_id = 10; 202 203 // Resource name of the conversion action associated with this conversion 204 // adjustment. 205 optional string conversion_action = 7; 206 207 // The date time at which the adjustment occurred. The format is 208 // "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00". 209 optional string adjustment_date_time = 8; 210 211 // The adjustment type. 212 google.ads.googleads.v16.enums.ConversionAdjustmentTypeEnum 213 .ConversionAdjustmentType adjustment_type = 5; 214} 215