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.shopping.merchant.conversions.v1beta; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/protobuf/empty.proto"; 24import "google/protobuf/field_mask.proto"; 25import "google/protobuf/timestamp.proto"; 26 27option go_package = "cloud.google.com/go/shopping/merchant/conversions/apiv1beta/conversionspb;conversionspb"; 28option java_multiple_files = true; 29option java_outer_classname = "ConversionSourcesProto"; 30option java_package = "com.google.shopping.merchant.conversions.v1beta"; 31option (google.api.resource_definition) = { 32 type: "merchantapi.googleapis.com/Account" 33 pattern: "accounts/{account}" 34}; 35 36// Service for managing conversion sources for a merchant account. 37service ConversionSourcesService { 38 option (google.api.default_host) = "merchantapi.googleapis.com"; 39 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content"; 40 41 // Creates a new conversion source. 42 rpc CreateConversionSource(CreateConversionSourceRequest) 43 returns (ConversionSource) { 44 option (google.api.http) = { 45 post: "/conversions/v1beta/{parent=accounts/*}/conversionSources" 46 body: "conversion_source" 47 }; 48 option (google.api.method_signature) = "parent,conversion_source"; 49 } 50 51 // Updates information of an existing conversion source. Available only for 52 // Merchant Center Destination conversion sources. 53 rpc UpdateConversionSource(UpdateConversionSourceRequest) 54 returns (ConversionSource) { 55 option (google.api.http) = { 56 patch: "/conversions/v1beta/{conversion_source.name=accounts/*/conversionSources/*}" 57 body: "conversion_source" 58 }; 59 option (google.api.method_signature) = "conversion_source,update_mask"; 60 } 61 62 // Archives an existing conversion source. If the conversion source is a 63 // Merchant Center Destination, it will be recoverable for 30 days. If the 64 // conversion source is a Google Analytics Link, it will be deleted 65 // immediately and can be restored by creating a new one. 66 rpc DeleteConversionSource(DeleteConversionSourceRequest) 67 returns (google.protobuf.Empty) { 68 option (google.api.http) = { 69 delete: "/conversions/v1beta/{name=accounts/*/conversionSources/*}" 70 }; 71 option (google.api.method_signature) = "name"; 72 } 73 74 // Re-enables an archived conversion source. Only Available for Merchant 75 // Center Destination conversion sources. 76 rpc UndeleteConversionSource(UndeleteConversionSourceRequest) 77 returns (ConversionSource) { 78 option (google.api.http) = { 79 post: "/conversions/v1beta/{name=accounts/*/conversionSources/*}:undelete" 80 body: "*" 81 }; 82 } 83 84 // Fetches a conversion source. 85 rpc GetConversionSource(GetConversionSourceRequest) 86 returns (ConversionSource) { 87 option (google.api.http) = { 88 get: "/conversions/v1beta/{name=accounts/*/conversionSources/*}" 89 }; 90 option (google.api.method_signature) = "name"; 91 } 92 93 // Retrieves the list of conversion sources the caller has access to. 94 rpc ListConversionSources(ListConversionSourcesRequest) 95 returns (ListConversionSourcesResponse) { 96 option (google.api.http) = { 97 get: "/conversions/v1beta/{parent=accounts/*}/conversionSources" 98 }; 99 option (google.api.method_signature) = "parent"; 100 } 101} 102 103// Represents a conversion source owned by a Merchant account. A merchant 104// account can have up to 200 conversion sources. 105message ConversionSource { 106 option (google.api.resource) = { 107 type: "merchantapi.googleapis.com/ConversionSource" 108 pattern: "accounts/{account}/conversionSources/{conversion_source}" 109 plural: "conversionSources" 110 singular: "conversionSource" 111 }; 112 113 // Represents state of the conversion source. 114 enum State { 115 // Conversion source has unspecified state. 116 STATE_UNSPECIFIED = 0; 117 118 // Conversion source is fully functional. 119 ACTIVE = 1; 120 121 // Conversion source has been archived in the last 30 days and not 122 // currently functional. Can be restored using the undelete method. 123 ARCHIVED = 2; 124 125 // Conversion source creation has started but not fully finished yet. 126 PENDING = 3; 127 } 128 129 // Entity controlling the conversion source. 130 enum Controller { 131 // Default value. This value is unused. 132 CONTROLLER_UNSPECIFIED = 0; 133 134 // Controlled by the Merchant who owns the Conversion Source. 135 MERCHANT = 1; 136 137 // Controlled by the YT Affiliates program. 138 YOUTUBE_AFFILIATES = 2; 139 } 140 141 // Required. 142 // Conversion source data specific to each different type of source. 143 oneof source_data { 144 // Immutable. Conversion Source of type "Link to Google Analytics Property". 145 GoogleAnalyticsLink google_analytics_link = 3 146 [(google.api.field_behavior) = IMMUTABLE]; 147 148 // Conversion Source of type "Merchant Center Tag Destination". 149 MerchantCenterDestination merchant_center_destination = 4; 150 } 151 152 // Output only. Identifier. Generated by the Content API upon creation of a 153 // new `ConversionSource`. Format: [a-z]{4}:.+ The four characters before the 154 // colon represent the type of conversio source. Content after the colon 155 // represents the ID of the conversion source within that type. The ID of two 156 // different conversion sources might be the same across different types. The 157 // following type prefixes are supported: 158 // - galk: For GoogleAnalyticsLink sources. 159 // - mcdn: For MerchantCenterDestination sources. 160 string name = 1 [ 161 (google.api.field_behavior) = OUTPUT_ONLY, 162 (google.api.field_behavior) = IDENTIFIER 163 ]; 164 165 // Output only. Current state of this conversion source. Can't be edited 166 // through the API. 167 State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 168 169 // Output only. The time when an archived conversion source becomes 170 // permanently deleted and is no longer available to undelete. 171 google.protobuf.Timestamp expire_time = 6 172 [(google.api.field_behavior) = OUTPUT_ONLY]; 173 174 // Output only. Controller of the conversion source. 175 Controller controller = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; 176} 177 178// Represents attribution settings for conversion sources receiving 179// pre-attribution data. 180message AttributionSettings { 181 // Message representing a types of conversion events 182 message ConversionType { 183 // Output only. Conversion event name, as it'll be reported by the client. 184 string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 185 186 // Output only. Option indicating if the type should be included in Merchant 187 // Center reporting. 188 bool report = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 189 } 190 191 // The attribution model used for this source. We support the same set of 192 // models offered by Google Analytics 4, as described in: 193 // https://support.google.com/analytics/answer/10596866. 194 enum AttributionModel { 195 // Unspecified model. 196 ATTRIBUTION_MODEL_UNSPECIFIED = 0; 197 198 // Cross-channel Last Click model. 199 CROSS_CHANNEL_LAST_CLICK = 1; 200 201 // Ads-preferred Last Click model. 202 ADS_PREFERRED_LAST_CLICK = 2; 203 204 // Cross-channel Data Driven model. 205 CROSS_CHANNEL_DATA_DRIVEN = 5; 206 207 // Cross-channel First Click model. 208 CROSS_CHANNEL_FIRST_CLICK = 6; 209 210 // Cross-channel Linear model. 211 CROSS_CHANNEL_LINEAR = 7; 212 213 // Cross-channel Position Based model. 214 CROSS_CHANNEL_POSITION_BASED = 8; 215 216 // Cross-channel Time Decay model. 217 CROSS_CHANNEL_TIME_DECAY = 9; 218 } 219 220 // Required. Lookback windows (in days) used for attribution in this source. 221 // Supported values are 7, 30, 40. 222 int32 attribution_lookback_window_days = 1 223 [(google.api.field_behavior) = REQUIRED]; 224 225 // Required. Attribution model. 226 AttributionModel attribution_model = 2 227 [(google.api.field_behavior) = REQUIRED]; 228 229 // Immutable. Unordered list. List of different conversion types a conversion 230 // event can be classified as. A standard "purchase" type will be 231 // automatically created if this list is empty at creation time. 232 repeated ConversionType conversion_type = 3 [ 233 (google.api.field_behavior) = UNORDERED_LIST, 234 (google.api.field_behavior) = IMMUTABLE 235 ]; 236} 237 238// "Google Analytics Link" sources can be used to get conversion data from an 239// existing Google Analytics property into the linked Merchant Center account. 240message GoogleAnalyticsLink { 241 // Required. Immutable. ID of the Google Analytics property the merchant is 242 // linked to. 243 int64 property_id = 1 [ 244 (google.api.field_behavior) = REQUIRED, 245 (google.api.field_behavior) = IMMUTABLE 246 ]; 247 248 // Output only. Attribution settings for the linked Google Analytics property. 249 AttributionSettings attribution_settings = 2 250 [(google.api.field_behavior) = OUTPUT_ONLY]; 251 252 // Output only. Name of the Google Analytics property the merchant is linked 253 // to. 254 string property = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 255} 256 257// "Merchant Center Destination" sources can be used to send conversion events 258// from a website using a Google tag directly to a Merchant Center account 259// where the source is created. 260message MerchantCenterDestination { 261 // Output only. Merchant Center Destination ID. 262 string destination = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 263 264 // Required. Attribution settings being used for the Merchant Center 265 // Destination. 266 AttributionSettings attribution_settings = 2 267 [(google.api.field_behavior) = REQUIRED]; 268 269 // Required. Merchant-specified display name for the destination. This is the 270 // name that identifies the conversion source within the Merchant Center UI. 271 // Limited to 64 characters. 272 string display_name = 3 [(google.api.field_behavior) = REQUIRED]; 273 274 // Required. Three-letter currency code (ISO 4217). The currency code defines 275 // in which currency the conversions sent to this destination will be reported 276 // in Merchant Center. 277 string currency_code = 4 [(google.api.field_behavior) = REQUIRED]; 278} 279 280// Request message for the CreateConversionSource method. 281message CreateConversionSourceRequest { 282 // Required. The merchant account that will own the new conversion source. 283 // Format: accounts/{account} 284 string parent = 1 [ 285 (google.api.field_behavior) = REQUIRED, 286 (google.api.resource_reference) = { 287 child_type: "merchantapi.googleapis.com/ConversionSource" 288 } 289 ]; 290 291 // Required. The conversion source description. A new ID will be automatically 292 // assigned to it upon creation. 293 ConversionSource conversion_source = 2 294 [(google.api.field_behavior) = REQUIRED]; 295} 296 297// Request message for the UpdateConversionSource method. 298message UpdateConversionSourceRequest { 299 // Required. The new version of the conversion source data. 300 // Format: accounts/{account}/conversionSources/{conversion_source} 301 ConversionSource conversion_source = 1 302 [(google.api.field_behavior) = REQUIRED]; 303 304 // Required. List of fields being updated. 305 google.protobuf.FieldMask update_mask = 2 306 [(google.api.field_behavior) = REQUIRED]; 307} 308 309// Request message for the DeleteConversionSource method. 310message DeleteConversionSourceRequest { 311 // Required. The name of the conversion source to be deleted. 312 // Format: accounts/{account}/conversionSources/{conversion_source} 313 string name = 1 [ 314 (google.api.field_behavior) = REQUIRED, 315 (google.api.resource_reference) = { 316 type: "merchantapi.googleapis.com/ConversionSource" 317 } 318 ]; 319} 320 321// Request message for the UndeleteConversionSource method. 322message UndeleteConversionSourceRequest { 323 // Required. The name of the conversion source to be undeleted. 324 // Format: accounts/{account}/conversionSources/{conversion_source} 325 string name = 1 [ 326 (google.api.field_behavior) = REQUIRED, 327 (google.api.resource_reference) = { 328 type: "merchantapi.googleapis.com/ConversionSource" 329 } 330 ]; 331} 332 333// Request message for the GetConversionSource method. 334message GetConversionSourceRequest { 335 // Required. The name of the conversion source to be fetched. 336 // Format: accounts/{account}/conversionsources/{conversion_source} 337 string name = 1 [ 338 (google.api.field_behavior) = REQUIRED, 339 (google.api.resource_reference) = { 340 type: "merchantapi.googleapis.com/ConversionSource" 341 } 342 ]; 343} 344 345// Request message for the ListConversionSources method. 346message ListConversionSourcesRequest { 347 // Required. The merchant account who owns the collection of conversion 348 // sources. Format: accounts/{account} 349 string parent = 1 [ 350 (google.api.field_behavior) = REQUIRED, 351 (google.api.resource_reference) = { 352 child_type: "merchantapi.googleapis.com/ConversionSource" 353 } 354 ]; 355 356 // Optional. The maximum number of conversion sources to return in a page. 357 // If no `page_size` is specified, `100` is used as the default value. The 358 // maximum value is `200`. Values above `200` will be coerced to `200`. 359 // Regardless of pagination, at most `200` conversion sources are returned 360 // in total. 361 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 362 363 // Optional. Page token. 364 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 365 366 // Optional. Show deleted (archived) option. 367 bool show_deleted = 4 [(google.api.field_behavior) = OPTIONAL]; 368} 369 370// Response message for the ListConversionSources method. 371message ListConversionSourcesResponse { 372 // List of conversion sources. 373 repeated ConversionSource conversion_sources = 1; 374 375 // Token to be used to fetch the next results page. 376 string next_page_token = 2; 377} 378