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.common; 18 19import "google/ads/googleads/v16/common/consent.proto"; 20import "google/ads/googleads/v16/enums/user_identifier_source.proto"; 21import "google/api/field_behavior.proto"; 22 23option csharp_namespace = "Google.Ads.GoogleAds.V16.Common"; 24option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v16/common;common"; 25option java_multiple_files = true; 26option java_outer_classname = "OfflineUserDataProto"; 27option java_package = "com.google.ads.googleads.v16.common"; 28option objc_class_prefix = "GAA"; 29option php_namespace = "Google\\Ads\\GoogleAds\\V16\\Common"; 30option ruby_package = "Google::Ads::GoogleAds::V16::Common"; 31 32// Proto file describing offline user data. 33 34// Address identifier of offline data. 35message OfflineUserAddressInfo { 36 // First name of the user, which is hashed as SHA-256 after normalized 37 // (Lowercase all characters; Remove any extra spaces before, after, and in 38 // between). 39 optional string hashed_first_name = 7; 40 41 // Last name of the user, which is hashed as SHA-256 after normalized (lower 42 // case only and no punctuation). 43 optional string hashed_last_name = 8; 44 45 // City of the address. Only accepted for Store Sales and 46 // ConversionAdjustmentUploadService. 47 optional string city = 9; 48 49 // State code of the address. Only accepted for Store Sales and 50 // ConversionAdjustmentUploadService. 51 optional string state = 10; 52 53 // 2-letter country code in ISO-3166-1 alpha-2 of the user's address. 54 optional string country_code = 11; 55 56 // Postal code of the user's address. 57 optional string postal_code = 12; 58 59 // The street address of the user hashed using SHA-256 hash function after 60 // normalization (lower case only). Only accepted for 61 // ConversionAdjustmentUploadService. 62 optional string hashed_street_address = 13; 63} 64 65// User identifying information. 66message UserIdentifier { 67 // Source of the user identifier when the upload is from Store Sales, 68 // ConversionUploadService, or ConversionAdjustmentUploadService. 69 google.ads.googleads.v16.enums.UserIdentifierSourceEnum.UserIdentifierSource 70 user_identifier_source = 6; 71 72 // Exactly one must be specified. For OfflineUserDataJobService, Customer 73 // Match accepts hashed_email, hashed_phone_number, mobile_id, 74 // third_party_user_id, and address_info; Store Sales accepts hashed_email, 75 // hashed_phone_number, third_party_user_id, and address_info. 76 // ConversionUploadService accepts hashed_email and hashed_phone_number. 77 // ConversionAdjustmentUploadService accepts hashed_email, 78 // hashed_phone_number, and address_info. 79 oneof identifier { 80 // Hashed email address using SHA-256 hash function after normalization. 81 // Accepted for Customer Match, Store Sales, ConversionUploadService, and 82 // ConversionAdjustmentUploadService. 83 string hashed_email = 7; 84 85 // Hashed phone number using SHA-256 hash function after normalization 86 // (E164 standard). Accepted for Customer Match, Store Sales, 87 // ConversionUploadService, and ConversionAdjustmentUploadService. 88 string hashed_phone_number = 8; 89 90 // Mobile device ID (advertising ID/IDFA). Accepted only for Customer Match. 91 string mobile_id = 9; 92 93 // Advertiser-assigned user ID for Customer Match upload, or 94 // third-party-assigned user ID for Store Sales. Accepted only for Customer 95 // Match and Store Sales. 96 string third_party_user_id = 10; 97 98 // Address information. Accepted only for Customer Match, Store Sales, and 99 // ConversionAdjustmentUploadService. 100 OfflineUserAddressInfo address_info = 5; 101 } 102} 103 104// Attribute of the store sales transaction. 105message TransactionAttribute { 106 // Timestamp when transaction occurred. Required. 107 // The format is "YYYY-MM-DD HH:MM:SS[+/-HH:MM]", where [+/-HH:MM] is an 108 // optional timezone offset from UTC. If the offset is absent, the API will 109 // use the account's timezone as default. 110 // Examples: "2018-03-05 09:15:00" or "2018-02-01 14:34:30+03:00" 111 optional string transaction_date_time = 8; 112 113 // Transaction amount in micros. Required. 114 // Transaction amount in micros needs to be greater than 1000. 115 // If item Attributes are provided, it represents the total value of the 116 // items, after multiplying the unit price per item by the quantity provided 117 // in the ItemAttributes. 118 optional double transaction_amount_micros = 9; 119 120 // Transaction currency code. ISO 4217 three-letter code is used. Required. 121 optional string currency_code = 10; 122 123 // The resource name of conversion action to report conversions to. 124 // Required. 125 optional string conversion_action = 11; 126 127 // Transaction order id. 128 // Accessible only to customers on the allow-list. 129 optional string order_id = 12; 130 131 // Store attributes of the transaction. 132 // Accessible only to customers on the allow-list. 133 StoreAttribute store_attribute = 6; 134 135 // Value of the custom variable for each transaction. 136 // Accessible only to customers on the allow-list. 137 optional string custom_value = 13; 138 139 // Item attributes of the transaction. 140 ItemAttribute item_attribute = 14; 141} 142 143// Store attributes of the transaction. 144message StoreAttribute { 145 // Store code from 146 // https://support.google.com/business/answer/3370250#storecode 147 optional string store_code = 2; 148} 149 150// Item attributes of the transaction. 151message ItemAttribute { 152 // A unique identifier of a product. It can be either the Merchant Center Item 153 // ID or GTIN (Global Trade Item Number). 154 string item_id = 1; 155 156 // ID of the Merchant Center Account. 157 optional int64 merchant_id = 2; 158 159 // Common Locale Data Repository (CLDR) territory code of the country 160 // associated with the feed where your items are uploaded. See 161 // https://developers.google.com/google-ads/api/reference/data/codes-formats#country-codes 162 // for more information. 163 string country_code = 3; 164 165 // ISO 639-1 code of the language associated with the feed where your items 166 // are uploaded 167 string language_code = 4; 168 169 // The number of items sold. Defaults to 1 if not set. 170 int64 quantity = 5; 171} 172 173// User data holding user identifiers and attributes. 174message UserData { 175 // User identification info. Required. 176 repeated UserIdentifier user_identifiers = 1; 177 178 // Additional transactions/attributes associated with the user. 179 // Required when updating store sales data. 180 TransactionAttribute transaction_attribute = 2; 181 182 // Additional attributes associated with the user. Required when updating 183 // customer match attributes. These have an expiration of 540 days. 184 UserAttribute user_attribute = 3; 185 186 // The consent setting for the user. Customer match will ignore this field 187 // and return a warning. 188 optional Consent consent = 4; 189} 190 191// User attribute, can only be used with CUSTOMER_MATCH_WITH_ATTRIBUTES job 192// type. 193message UserAttribute { 194 // Advertiser defined lifetime value for the user. 195 optional int64 lifetime_value_micros = 1; 196 197 // Advertiser defined lifetime value bucket for the user. The valid range for 198 // a lifetime value bucket is from 1 (low) to 10 (high), except for remove 199 // operation where 0 will also be accepted. 200 optional int32 lifetime_value_bucket = 2; 201 202 // Timestamp of the last purchase made by the user. 203 // The format is YYYY-MM-DD HH:MM:SS[+/-HH:MM], where [+/-HH:MM] is an 204 // optional timezone offset from UTC. If the offset is absent, the API will 205 // use the account's timezone as default. 206 string last_purchase_date_time = 3; 207 208 // Advertiser defined average number of purchases that are made by the user in 209 // a 30 day period. 210 int32 average_purchase_count = 4; 211 212 // Advertiser defined average purchase value in micros for the user. 213 int64 average_purchase_value_micros = 5; 214 215 // Timestamp when the user was acquired. 216 // The format is YYYY-MM-DD HH:MM:SS[+/-HH:MM], where [+/-HH:MM] is an 217 // optional timezone offset from UTC. If the offset is absent, the API will 218 // use the account's timezone as default. 219 string acquisition_date_time = 6; 220 221 // The shopping loyalty related data. Shopping utilizes this data to provide 222 // users with a better experience. Accessible only to merchants on the 223 // allow-list with the user's consent. 224 optional ShoppingLoyalty shopping_loyalty = 7; 225 226 // Optional. Advertiser defined lifecycle stage for the user. The accepted 227 // values are "Lead", "Active" and "Churned". 228 string lifecycle_stage = 8 [(google.api.field_behavior) = OPTIONAL]; 229 230 // Optional. Timestamp of the first purchase made by the user. 231 // The format is YYYY-MM-DD HH:MM:SS[+/-HH:MM], where [+/-HH:MM] is an 232 // optional timezone offset from UTC. If the offset is absent, the API will 233 // use the account's timezone as default. 234 string first_purchase_date_time = 9 [(google.api.field_behavior) = OPTIONAL]; 235 236 // Optional. Advertiser defined events and their attributes. All the values in 237 // the nested fields are required. Currently this field is in beta. 238 repeated EventAttribute event_attribute = 10 239 [(google.api.field_behavior) = OPTIONAL]; 240} 241 242// Advertiser defined events and their attributes. All the values in the 243// nested fields are required. 244message EventAttribute { 245 // Required. Advertiser defined event to be used for remarketing. The accepted 246 // values are "Viewed", "Cart", "Purchased" and "Recommended". 247 string event = 1 [(google.api.field_behavior) = REQUIRED]; 248 249 // Required. Timestamp at which the event happened. 250 // The format is YYYY-MM-DD HH:MM:SS[+/-HH:MM], where [+/-HH:MM] is an 251 // optional timezone offset from UTC. If the offset is absent, the API will 252 // use the account's timezone as default. 253 string event_date_time = 2 [(google.api.field_behavior) = REQUIRED]; 254 255 // Required. Item attributes of the event. 256 repeated EventItemAttribute item_attribute = 3 257 [(google.api.field_behavior) = REQUIRED]; 258} 259 260// Event Item attributes of the Customer Match. 261message EventItemAttribute { 262 // Optional. A unique identifier of a product. It can be either the Merchant 263 // Center Item ID or GTIN (Global Trade Item Number). 264 string item_id = 1 [(google.api.field_behavior) = OPTIONAL]; 265} 266 267// The shopping loyalty related data. Shopping utilizes this data to provide 268// users with a better experience. 269// Accessible only to merchants on the allow-list. 270message ShoppingLoyalty { 271 // The membership tier. It is a free-form string as each merchant may have 272 // their own loyalty system. For example, it could be a number from 1 to 10, 273 // or a string such as "Golden" or "Silver", or even empty string "". 274 optional string loyalty_tier = 1; 275} 276 277// Metadata for customer match user list. 278message CustomerMatchUserListMetadata { 279 // The resource name of remarketing list to update data. 280 // Required for job of CUSTOMER_MATCH_USER_LIST type. 281 optional string user_list = 2; 282 283 // The consent setting for all the users in this job. 284 optional Consent consent = 3; 285} 286 287// Metadata for Store Sales Direct. 288message StoreSalesMetadata { 289 // This is the fraction of all transactions that are identifiable (for 290 // example, associated with any form of customer information). Required. The 291 // fraction needs to be between 0 and 1 (excluding 0). 292 optional double loyalty_fraction = 5; 293 294 // This is the ratio of sales being uploaded compared to the overall sales 295 // that can be associated with a customer. Required. 296 // The fraction needs to be between 0 and 1 (excluding 0). For example, if you 297 // upload half the sales that you are able to associate with a customer, this 298 // would be 0.5. 299 optional double transaction_upload_fraction = 6; 300 301 // Name of the store sales custom variable key. A predefined key that 302 // can be applied to the transaction and then later used for custom 303 // segmentation in reporting. 304 // Accessible only to customers on the allow-list. 305 optional string custom_key = 7; 306 307 // Metadata for a third party Store Sales upload. 308 StoreSalesThirdPartyMetadata third_party_metadata = 3; 309} 310 311// Metadata for a third party Store Sales. 312// This product is only for customers on the allow-list. Contact your 313// Google business development representative for details on the upload 314// configuration. 315message StoreSalesThirdPartyMetadata { 316 // Time the advertiser uploaded the data to the partner. Required. 317 // The format is "YYYY-MM-DD HH:MM:SS". 318 // Examples: "2018-03-05 09:15:00" or "2018-02-01 14:34:30" 319 optional string advertiser_upload_date_time = 7; 320 321 // The fraction of transactions that are valid. Invalid transactions may 322 // include invalid formats or values. 323 // Required. 324 // The fraction needs to be between 0 and 1 (excluding 0). 325 optional double valid_transaction_fraction = 8; 326 327 // The fraction of valid transactions that are matched to a third party 328 // assigned user ID on the partner side. 329 // Required. 330 // The fraction needs to be between 0 and 1 (excluding 0). 331 optional double partner_match_fraction = 9; 332 333 // The fraction of valid transactions that are uploaded by the partner to 334 // Google. 335 // Required. 336 // The fraction needs to be between 0 and 1 (excluding 0). 337 optional double partner_upload_fraction = 10; 338 339 // Version of partner IDs to be used for uploads. Required. 340 optional string bridge_map_version_id = 11; 341 342 // ID of the third party partner updating the transaction feed. 343 optional int64 partner_id = 12; 344} 345