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