0
# Conversion Tracking
1
2
Conversion action management and conversion data upload including conversion action configuration, offline conversion uploads, and conversion value optimization. The Google Ads API provides comprehensive conversion tracking capabilities for measuring and optimizing advertising performance.
3
4
## Capabilities
5
6
### Conversion Action Operations
7
8
Conversion action management operations for creating and configuring conversion tracking including website conversions, phone call conversions, and app conversions.
9
10
```python { .api }
11
def mutate_conversion_actions(
12
self,
13
request: Optional[MutateConversionActionsRequest] = None,
14
customer_id: Optional[str] = None,
15
operations: Optional[Sequence[ConversionActionOperation]] = None,
16
partial_failure: bool = False,
17
validate_only: bool = False,
18
response_content_type: Optional[ResponseContentTypeEnum.ResponseContentType] = None
19
) -> MutateConversionActionsResponse:
20
"""
21
Create, update, or remove conversion actions.
22
23
Args:
24
request: The request object containing all parameters
25
customer_id: Required customer ID for the account
26
operations: List of conversion action operations to perform
27
partial_failure: Continue processing on individual failures
28
validate_only: Validate operations without executing
29
response_content_type: Type of response content to return
30
31
Returns:
32
MutateConversionActionsResponse with operation results
33
"""
34
35
def get_conversion_action(
36
self,
37
request: Optional[GetConversionActionRequest] = None,
38
resource_name: Optional[str] = None
39
) -> ConversionAction:
40
"""
41
Retrieve a conversion action by resource name.
42
43
Args:
44
request: The request object
45
resource_name: Conversion action resource name (customers/{customer_id}/conversionActions/{conversion_action_id})
46
47
Returns:
48
ConversionAction resource object
49
"""
50
```
51
52
### Conversion Upload Operations
53
54
Conversion data upload operations for importing offline conversions, call conversions, and other conversion events that occur outside of the web tracking environment.
55
56
```python { .api }
57
def upload_conversions(
58
self,
59
request: Optional[UploadConversionsRequest] = None,
60
customer_id: Optional[str] = None,
61
conversions: Optional[Sequence[Conversion]] = None,
62
partial_failure: bool = False,
63
validate_only: bool = False
64
) -> UploadConversionsResponse:
65
"""
66
Upload offline conversions.
67
68
Args:
69
request: The request object
70
customer_id: Required customer ID
71
conversions: List of conversion data to upload
72
partial_failure: Continue on individual failures
73
validate_only: Validate without uploading
74
75
Returns:
76
UploadConversionsResponse with upload results
77
"""
78
79
def upload_call_conversions(
80
self,
81
request: Optional[UploadCallConversionsRequest] = None,
82
customer_id: Optional[str] = None,
83
conversions: Optional[Sequence[CallConversion]] = None,
84
partial_failure: bool = False,
85
validate_only: bool = False
86
) -> UploadCallConversionsResponse:
87
"""
88
Upload call conversion data.
89
90
Args:
91
request: The request object
92
customer_id: Required customer ID
93
conversions: List of call conversion data
94
partial_failure: Continue on individual failures
95
validate_only: Validate without uploading
96
97
Returns:
98
UploadCallConversionsResponse with results
99
"""
100
101
def upload_click_conversions(
102
self,
103
request: Optional[UploadClickConversionsRequest] = None,
104
customer_id: Optional[str] = None,
105
conversions: Optional[Sequence[ClickConversion]] = None,
106
partial_failure: bool = False,
107
validate_only: bool = False
108
) -> UploadClickConversionsResponse:
109
"""
110
Upload click conversion data.
111
112
Args:
113
request: The request object
114
customer_id: Required customer ID
115
conversions: List of click conversion data
116
partial_failure: Continue on individual failures
117
validate_only: Validate without uploading
118
119
Returns:
120
UploadClickConversionsResponse with results
121
"""
122
```
123
124
### Conversion Adjustment Operations
125
126
Conversion adjustment operations for modifying previously uploaded conversion data including conversion value adjustments and conversion restatements.
127
128
```python { .api }
129
def upload_conversion_adjustments(
130
self,
131
request: Optional[UploadConversionAdjustmentsRequest] = None,
132
customer_id: Optional[str] = None,
133
conversion_adjustments: Optional[Sequence[ConversionAdjustment]] = None,
134
partial_failure: bool = False,
135
validate_only: bool = False
136
) -> UploadConversionAdjustmentsResponse:
137
"""
138
Upload conversion adjustments to modify existing conversions.
139
140
Args:
141
request: The request object
142
customer_id: Required customer ID
143
conversion_adjustments: List of conversion adjustments
144
partial_failure: Continue on individual failures
145
validate_only: Validate without uploading
146
147
Returns:
148
UploadConversionAdjustmentsResponse with results
149
"""
150
```
151
152
### Conversion Custom Variable Operations
153
154
Custom variable management for enhanced conversion tracking including custom dimensions and conversion value modifiers for advanced attribution and analysis.
155
156
```python { .api }
157
def mutate_conversion_custom_variables(
158
self,
159
request: Optional[MutateConversionCustomVariablesRequest] = None,
160
customer_id: Optional[str] = None,
161
operations: Optional[Sequence[ConversionCustomVariableOperation]] = None,
162
partial_failure: bool = False,
163
validate_only: bool = False,
164
response_content_type: Optional[ResponseContentTypeEnum.ResponseContentType] = None
165
) -> MutateConversionCustomVariablesResponse:
166
"""
167
Create, update, or remove conversion custom variables.
168
169
Args:
170
request: The request object
171
customer_id: Required customer ID
172
operations: List of custom variable operations
173
partial_failure: Continue on individual failures
174
validate_only: Validate without executing
175
response_content_type: Response content type
176
177
Returns:
178
MutateConversionCustomVariablesResponse with results
179
"""
180
```
181
182
## Conversion Action Creation Examples
183
184
### Website Conversion Action
185
186
```python
187
from google.ads.googleads.client import GoogleAdsClient
188
from google.ads.googleads.errors import GoogleAdsException
189
190
def create_website_conversion_action(client, customer_id, conversion_name, value_settings=None):
191
"""Create a website conversion action for tracking web conversions."""
192
193
conversion_action_service = client.get_service("ConversionActionService")
194
195
# Create conversion action operation
196
operation = client.get_type("ConversionActionOperation")
197
conversion_action = operation.create
198
199
# Set basic properties
200
conversion_action.name = conversion_name
201
conversion_action.category = client.enums.ConversionActionCategoryEnum.PURCHASE
202
conversion_action.type_ = client.enums.ConversionActionTypeEnum.WEBPAGE
203
conversion_action.status = client.enums.ConversionActionStatusEnum.ENABLED
204
205
# Configure value settings
206
value_settings = value_settings or {}
207
conversion_action.value_settings.default_value = value_settings.get('default_value', 1.0)
208
conversion_action.value_settings.default_currency_code = value_settings.get('currency_code', 'USD')
209
conversion_action.value_settings.always_use_default_value = value_settings.get('always_use_default', False)
210
211
# Set counting type
212
conversion_action.counting_type = client.enums.ConversionActionCountingTypeEnum.ONE_PER_CLICK
213
214
# Set click-through conversion window
215
conversion_action.click_through_lookback_window_days = 30
216
217
# Set view-through conversion window
218
conversion_action.view_through_lookback_window_days = 1
219
220
# Configure attribution settings
221
conversion_action.attribution_model_settings.attribution_model = client.enums.ConversionAttributionModelEnum.LAST_CLICK
222
conversion_action.attribution_model_settings.data_driven_model_status = client.enums.ConversionAttributionModelEnum.LAST_CLICK
223
224
# Set tag generation settings
225
tag_settings = conversion_action.tag_settings
226
tag_settings.tag_code_type = client.enums.TrackingCodeTypeEnum.WEBPAGE
227
tag_settings.cross_domain_tracking_enabled = True
228
229
try:
230
response = conversion_action_service.mutate_conversion_actions(
231
customer_id=customer_id,
232
operations=[operation]
233
)
234
235
conversion_action_resource_name = response.results[0].resource_name
236
print(f"Created conversion action: {conversion_action_resource_name}")
237
238
# Get the generated tag snippet
239
conversion_action_response = conversion_action_service.get_conversion_action(
240
resource_name=conversion_action_resource_name
241
)
242
243
tag_snippets = conversion_action_response.tag_snippets
244
for snippet in tag_snippets:
245
print(f"Tag Type: {snippet.type_.name}")
246
print(f"Global Site Tag: {snippet.global_site_tag}")
247
print(f"Event Snippet: {snippet.event_snippet}")
248
249
return conversion_action_resource_name
250
251
except GoogleAdsException as ex:
252
print(f"Request failed with status {ex.error.code().name}")
253
for error in ex.failure.errors:
254
print(f"Error: {error.message}")
255
return None
256
257
# Example usage
258
value_settings = {
259
'default_value': 25.0,
260
'currency_code': 'USD',
261
'always_use_default': False
262
}
263
264
conversion_action = create_website_conversion_action(
265
client,
266
customer_id,
267
"Purchase Conversion",
268
value_settings
269
)
270
```
271
272
### Phone Call Conversion Action
273
274
```python
275
def create_phone_call_conversion_action(client, customer_id, conversion_name, phone_number):
276
"""Create a phone call conversion action for call tracking."""
277
278
conversion_action_service = client.get_service("ConversionActionService")
279
280
operation = client.get_type("ConversionActionOperation")
281
conversion_action = operation.create
282
283
# Set basic properties
284
conversion_action.name = conversion_name
285
conversion_action.category = client.enums.ConversionActionCategoryEnum.PHONE_CALL_LEAD
286
conversion_action.type_ = client.enums.ConversionActionTypeEnum.PHONE_CALL_LEAD
287
conversion_action.status = client.enums.ConversionActionStatusEnum.ENABLED
288
289
# Set call counting type
290
conversion_action.counting_type = client.enums.ConversionActionCountingTypeEnum.ONE_PER_CALL
291
292
# Configure phone call conversion settings
293
phone_call_details = conversion_action.phone_call_details
294
phone_call_details.phone_number = phone_number
295
phone_call_details.conversion_reporting_state = client.enums.CallConversionReportingStateEnum.USE_RESOURCE_LEVEL_CALL_CONVERSION_ACTION
296
297
# Set minimum call duration (in seconds)
298
phone_call_details.call_conversion_action = conversion_action.resource_name
299
300
# Set value settings
301
conversion_action.value_settings.default_value = 50.0
302
conversion_action.value_settings.default_currency_code = 'USD'
303
304
response = conversion_action_service.mutate_conversion_actions(
305
customer_id=customer_id,
306
operations=[operation]
307
)
308
309
return response.results[0].resource_name
310
```
311
312
### App Conversion Action
313
314
```python
315
def create_app_conversion_action(client, customer_id, conversion_name, app_id, event_type):
316
"""Create an app conversion action for mobile app tracking."""
317
318
conversion_action_service = client.get_service("ConversionActionService")
319
320
operation = client.get_type("ConversionActionOperation")
321
conversion_action = operation.create
322
323
# Set basic properties
324
conversion_action.name = conversion_name
325
conversion_action.category = client.enums.ConversionActionCategoryEnum.DOWNLOAD
326
conversion_action.type_ = client.enums.ConversionActionTypeEnum.APP_INSTALL
327
conversion_action.status = client.enums.ConversionActionStatusEnum.ENABLED
328
329
# Configure app details
330
app_details = conversion_action.app_details
331
app_details.app_id = app_id
332
app_details.app_store = client.enums.MobileAppVendorEnum.APPLE_APP_STORE # or GOOGLE_APP_STORE
333
334
# Set counting and attribution
335
conversion_action.counting_type = client.enums.ConversionActionCountingTypeEnum.ONE_PER_INSTALL
336
conversion_action.post_install_conversion_window_days = 30
337
338
response = conversion_action_service.mutate_conversion_actions(
339
customer_id=customer_id,
340
operations=[operation]
341
)
342
343
return response.results[0].resource_name
344
```
345
346
## Offline Conversion Upload Examples
347
348
### Upload Store Sales Conversions
349
350
```python
351
import datetime
352
import hashlib
353
354
def upload_store_sales_conversions(client, customer_id, conversion_action_resource_name, sales_data):
355
"""Upload offline store sales conversion data."""
356
357
conversion_upload_service = client.get_service("ConversionUploadService")
358
359
conversions = []
360
361
for sale in sales_data:
362
conversion = client.get_type("Conversion")
363
364
# Set conversion action
365
conversion.conversion_action = conversion_action_resource_name
366
367
# Set conversion date and time
368
conversion_date_time = datetime.datetime.strptime(sale['date_time'], '%Y-%m-%d %H:%M:%S')
369
conversion.conversion_date_time = conversion_date_time.strftime('%Y-%m-%d %H:%M:%S+00:00')
370
371
# Set conversion value
372
conversion.conversion_value = sale['value']
373
conversion.currency_code = sale.get('currency_code', 'USD')
374
375
# Set user identifiers for customer matching
376
if 'email' in sale:
377
# Hash the email for privacy
378
hashed_email = hashlib.sha256(sale['email'].lower().encode()).hexdigest()
379
conversion.user_identifiers.append(
380
client.get_type("UserIdentifier", hashed_email=hashed_email)
381
)
382
383
if 'phone' in sale:
384
# Hash the phone number
385
hashed_phone = hashlib.sha256(sale['phone'].encode()).hexdigest()
386
conversion.user_identifiers.append(
387
client.get_type("UserIdentifier", hashed_phone_number=hashed_phone)
388
)
389
390
# Set order ID if available
391
if 'order_id' in sale:
392
conversion.order_id = sale['order_id']
393
394
# Add custom variables if configured
395
if 'custom_variables' in sale:
396
for var_name, var_value in sale['custom_variables'].items():
397
custom_variable = client.get_type("CustomVariable")
398
custom_variable.conversion_custom_variable = f"customers/{customer_id}/conversionCustomVariables/{var_name}"
399
custom_variable.value = var_value
400
conversion.custom_variables.append(custom_variable)
401
402
conversions.append(conversion)
403
404
try:
405
response = conversion_upload_service.upload_conversions(
406
customer_id=customer_id,
407
conversions=conversions,
408
partial_failure=True
409
)
410
411
if response.partial_failure_error:
412
print("Some conversions failed to upload:")
413
for error in response.partial_failure_error.details:
414
print(f"Error: {error}")
415
416
print(f"Successfully uploaded {len(response.results)} conversions")
417
return response.results
418
419
except GoogleAdsException as ex:
420
print(f"Conversion upload failed: {ex.error.code().name}")
421
for error in ex.failure.errors:
422
print(f"Error: {error.message}")
423
return []
424
425
# Example usage
426
sales_data = [
427
{
428
'date_time': '2024-01-15 14:30:00',
429
'value': 125.50,
430
'currency_code': 'USD',
431
'email': 'customer1@example.com',
432
'order_id': 'ORDER_001',
433
'custom_variables': {
434
'store_location': 'NYC_Store_1',
435
'product_category': 'Electronics'
436
}
437
},
438
{
439
'date_time': '2024-01-15 16:45:00',
440
'value': 89.99,
441
'currency_code': 'USD',
442
'phone': '+1-555-123-4567',
443
'order_id': 'ORDER_002'
444
}
445
]
446
447
upload_store_sales_conversions(client, customer_id, conversion_action_resource_name, sales_data)
448
```
449
450
### Upload Call Conversions
451
452
```python
453
def upload_call_conversions(client, customer_id, call_conversion_data):
454
"""Upload call conversion data for phone call tracking."""
455
456
conversion_upload_service = client.get_service("ConversionUploadService")
457
458
call_conversions = []
459
460
for call_data in call_conversion_data:
461
call_conversion = client.get_type("CallConversion")
462
463
# Set caller ID
464
call_conversion.caller_id = call_data['caller_id']
465
466
# Set call start time
467
call_start_time = datetime.datetime.strptime(call_data['call_start_time'], '%Y-%m-%d %H:%M:%S')
468
call_conversion.call_start_date_time = call_start_time.strftime('%Y-%m-%d %H:%M:%S+00:00')
469
470
# Set conversion action
471
call_conversion.conversion_action = call_data['conversion_action_resource_name']
472
473
# Set conversion date time (when the conversion occurred)
474
conversion_time = datetime.datetime.strptime(call_data['conversion_time'], '%Y-%m-%d %H:%M:%S')
475
call_conversion.conversion_date_time = conversion_time.strftime('%Y-%m-%d %H:%M:%S+00:00')
476
477
# Set conversion value
478
if 'value' in call_data:
479
call_conversion.conversion_value = call_data['value']
480
call_conversion.currency_code = call_data.get('currency_code', 'USD')
481
482
call_conversions.append(call_conversion)
483
484
response = conversion_upload_service.upload_call_conversions(
485
customer_id=customer_id,
486
conversions=call_conversions,
487
partial_failure=True
488
)
489
490
return response.results
491
```
492
493
## Conversion Custom Variables
494
495
### Create Custom Variable
496
497
```python
498
def create_conversion_custom_variable(client, customer_id, variable_name, variable_tag):
499
"""Create a conversion custom variable for enhanced tracking."""
500
501
conversion_custom_variable_service = client.get_service("ConversionCustomVariableService")
502
503
operation = client.get_type("ConversionCustomVariableOperation")
504
custom_variable = operation.create
505
506
custom_variable.name = variable_name
507
custom_variable.tag = variable_tag
508
custom_variable.status = client.enums.ConversionCustomVariableStatusEnum.ENABLED
509
510
# Set the family (determines how the variable can be used)
511
custom_variable.family = client.enums.ConversionCustomVariableFamilyEnum.STANDARD
512
513
# Set cardinality type
514
custom_variable.cardinality_type = client.enums.ConversionCustomVariableCardinalityTypeEnum.BELOW_ALL_LIMITS
515
516
try:
517
response = conversion_custom_variable_service.mutate_conversion_custom_variables(
518
customer_id=customer_id,
519
operations=[operation]
520
)
521
522
return response.results[0].resource_name
523
524
except GoogleAdsException as ex:
525
print(f"Custom variable creation failed: {ex.error.code().name}")
526
for error in ex.failure.errors:
527
print(f"Error: {error.message}")
528
return None
529
530
# Example usage
531
store_location_variable = create_conversion_custom_variable(
532
client,
533
customer_id,
534
"Store Location",
535
"store_location"
536
)
537
538
product_category_variable = create_conversion_custom_variable(
539
client,
540
customer_id,
541
"Product Category",
542
"product_category"
543
)
544
```
545
546
## Conversion Adjustment Examples
547
548
### Adjust Conversion Values
549
550
```python
551
def adjust_conversion_values(client, customer_id, adjustment_data):
552
"""Upload conversion adjustments to modify existing conversions."""
553
554
conversion_adjustment_upload_service = client.get_service("ConversionAdjustmentUploadService")
555
556
conversion_adjustments = []
557
558
for adjustment in adjustment_data:
559
conversion_adjustment = client.get_type("ConversionAdjustment")
560
561
# Set the original conversion to adjust
562
conversion_adjustment.conversion_action = adjustment['conversion_action_resource_name']
563
564
# Set adjustment date and time
565
adjustment_time = datetime.datetime.strptime(adjustment['adjustment_date_time'], '%Y-%m-%d %H:%M:%S')
566
conversion_adjustment.adjustment_date_time = adjustment_time.strftime('%Y-%m-%d %H:%M:%S+00:00')
567
568
# Set adjustment type
569
conversion_adjustment.adjustment_type = adjustment['adjustment_type'] # ENHANCEMENT, RESTATEMENT, RETRACTION
570
571
# Set user identifiers to match the original conversion
572
if 'order_id' in adjustment:
573
conversion_adjustment.order_id = adjustment['order_id']
574
575
if 'user_identifiers' in adjustment:
576
for identifier in adjustment['user_identifiers']:
577
user_id = client.get_type("UserIdentifier")
578
if 'hashed_email' in identifier:
579
user_id.hashed_email = identifier['hashed_email']
580
elif 'hashed_phone' in identifier:
581
user_id.hashed_phone_number = identifier['hashed_phone']
582
conversion_adjustment.user_identifiers.append(user_id)
583
584
# Set new conversion value (for restatements/enhancements)
585
if 'new_value' in adjustment:
586
conversion_adjustment.restatement_value.adjusted_value = adjustment['new_value']
587
conversion_adjustment.restatement_value.currency_code = adjustment.get('currency_code', 'USD')
588
589
conversion_adjustments.append(conversion_adjustment)
590
591
try:
592
response = conversion_adjustment_upload_service.upload_conversion_adjustments(
593
customer_id=customer_id,
594
conversion_adjustments=conversion_adjustments,
595
partial_failure=True
596
)
597
598
print(f"Successfully processed {len(response.results)} conversion adjustments")
599
return response.results
600
601
except GoogleAdsException as ex:
602
print(f"Conversion adjustment upload failed: {ex.error.code().name}")
603
for error in ex.failure.errors:
604
print(f"Error: {error.message}")
605
return []
606
```
607
608
## Conversion Reporting and Analysis
609
610
### Get Conversion Performance
611
612
```python
613
def get_conversion_performance(client, customer_id, start_date, end_date):
614
"""Get conversion performance report by conversion action."""
615
616
googleads_service = client.get_service("GoogleAdsService")
617
618
query = f'''
619
SELECT
620
conversion_action.id,
621
conversion_action.name,
622
conversion_action.category,
623
conversion_action.type,
624
conversion_action.status,
625
metrics.conversions,
626
metrics.conversions_value,
627
metrics.cost_per_conversion,
628
metrics.conversion_rate,
629
metrics.value_per_conversion,
630
metrics.all_conversions,
631
metrics.all_conversions_value
632
FROM conversion_action
633
WHERE segments.date BETWEEN '{start_date}' AND '{end_date}'
634
ORDER BY metrics.conversions DESC
635
'''
636
637
response = googleads_service.search(
638
customer_id=customer_id,
639
query=query
640
)
641
642
conversion_performance = []
643
for row in response:
644
conversion_action = row.conversion_action
645
metrics = row.metrics
646
647
performance_data = {
648
'conversion_action_id': conversion_action.id,
649
'name': conversion_action.name,
650
'category': conversion_action.category.name,
651
'type': conversion_action.type_.name,
652
'status': conversion_action.status.name,
653
'conversions': metrics.conversions,
654
'conversions_value': metrics.conversions_value,
655
'cost_per_conversion': metrics.cost_per_conversion / 1_000_000 if metrics.cost_per_conversion else 0,
656
'conversion_rate': metrics.conversion_rate,
657
'value_per_conversion': metrics.value_per_conversion,
658
'all_conversions': metrics.all_conversions,
659
'all_conversions_value': metrics.all_conversions_value
660
}
661
conversion_performance.append(performance_data)
662
663
return conversion_performance
664
```
665
666
## Types
667
668
```python { .api }
669
# Conversion action types
670
class ConversionAction:
671
resource_name: str
672
id: Optional[int]
673
name: Optional[str]
674
status: ConversionActionStatusEnum.ConversionActionStatus
675
type_: ConversionActionTypeEnum.ConversionActionType
676
origin: ConversionOriginEnum.ConversionOrigin
677
primary_for_goal: Optional[bool]
678
category: ConversionActionCategoryEnum.ConversionActionCategory
679
owner_customer: Optional[str]
680
include_in_conversions_metric: Optional[bool]
681
click_through_lookback_window_days: Optional[int]
682
view_through_lookback_window_days: Optional[int]
683
value_settings: ValueSettings
684
counting_type: ConversionActionCountingTypeEnum.ConversionActionCountingType
685
attribution_model_settings: AttributionModelSettings
686
tag_snippets: List[TagSnippet]
687
phone_call_details: PhoneCallDetails
688
mobile_app_details: MobileAppDetails
689
third_party_app_analytics_settings: ThirdPartyAppAnalyticsSettings
690
firebase_settings: FirebaseSettings
691
google_analytics_4_settings: GoogleAnalytics4Settings
692
693
class ValueSettings:
694
default_value: Optional[float]
695
default_currency_code: Optional[str]
696
always_use_default_value: Optional[bool]
697
698
class AttributionModelSettings:
699
attribution_model: ConversionAttributionModelEnum.ConversionAttributionModel
700
data_driven_model_status: ConversionAttributionModelEnum.ConversionAttributionModel
701
702
class PhoneCallDetails:
703
phone_number: Optional[str]
704
conversion_reporting_state: CallConversionReportingStateEnum.CallConversionReportingState
705
706
# Conversion upload types
707
class Conversion:
708
conversion_action: Optional[str]
709
conversion_date_time: Optional[str]
710
conversion_value: Optional[float]
711
currency_code: Optional[str]
712
order_id: Optional[str]
713
external_attribution_data: ExternalAttributionData
714
click_identifier: Optional[str]
715
job_id: Optional[int]
716
user_identifiers: List[UserIdentifier]
717
user_agent: Optional[str]
718
custom_variables: List[CustomVariable]
719
cart_data: CartData
720
consent: Consent
721
722
class CallConversion:
723
caller_id: Optional[str]
724
call_start_date_time: Optional[str]
725
conversion_action: Optional[str]
726
conversion_date_time: Optional[str]
727
conversion_value: Optional[float]
728
currency_code: Optional[str]
729
730
class ClickConversion:
731
gclid: Optional[str]
732
gbraid: Optional[str]
733
wbraid: Optional[str]
734
conversion_action: Optional[str]
735
conversion_date_time: Optional[str]
736
conversion_value: Optional[float]
737
currency_code: Optional[str]
738
order_id: Optional[str]
739
external_attribution_data: ExternalAttributionData
740
custom_variables: List[CustomVariable]
741
cart_data: CartData
742
user_identifiers: List[UserIdentifier]
743
consent: Consent
744
745
class ConversionAdjustment:
746
conversion_action: Optional[str]
747
adjustment_date_time: Optional[str]
748
adjustment_type: ConversionAdjustmentTypeEnum.ConversionAdjustmentType
749
order_id: Optional[str]
750
user_identifiers: List[UserIdentifier]
751
user_agent: Optional[str]
752
restatement_value: RestatementValue
753
754
class RestatementValue:
755
adjusted_value: Optional[float]
756
currency_code: Optional[str]
757
758
class UserIdentifier:
759
user_identifier_source: UserIdentifierSourceEnum.UserIdentifierSource
760
hashed_email: Optional[str]
761
hashed_phone_number: Optional[str]
762
mobile_id: Optional[str]
763
third_party_user_id: Optional[str]
764
address_info: OfflineUserAddressInfo
765
766
# Custom variable types
767
class ConversionCustomVariable:
768
resource_name: str
769
id: Optional[int]
770
name: Optional[str]
771
tag: Optional[str]
772
status: ConversionCustomVariableStatusEnum.ConversionCustomVariableStatus
773
owner_customer: Optional[str]
774
family: ConversionCustomVariableFamilyEnum.ConversionCustomVariableFamily
775
cardinality_type: ConversionCustomVariableCardinalityTypeEnum.ConversionCustomVariableCardinalityType
776
777
class CustomVariable:
778
conversion_custom_variable: Optional[str]
779
value: Optional[str]
780
781
# Operation types
782
class ConversionActionOperation:
783
update_mask: FieldMask
784
create: ConversionAction
785
update: ConversionAction
786
remove: str
787
788
class ConversionCustomVariableOperation:
789
update_mask: FieldMask
790
create: ConversionCustomVariable
791
update: ConversionCustomVariable
792
remove: str
793
794
# Request types
795
class UploadConversionsRequest:
796
customer_id: str
797
conversions: List[Conversion]
798
partial_failure: bool
799
validate_only: bool
800
debug_enabled: bool
801
job_id: int
802
803
class UploadCallConversionsRequest:
804
customer_id: str
805
conversions: List[CallConversion]
806
partial_failure: bool
807
validate_only: bool
808
809
class UploadClickConversionsRequest:
810
customer_id: str
811
conversions: List[ClickConversion]
812
partial_failure: bool
813
validate_only: bool
814
debug_enabled: bool
815
job_id: int
816
817
class UploadConversionAdjustmentsRequest:
818
customer_id: str
819
conversion_adjustments: List[ConversionAdjustment]
820
partial_failure: bool
821
validate_only: bool
822
job_id: int
823
824
# Response types
825
class MutateConversionActionsResponse:
826
partial_failure_error: Status
827
results: List[MutateConversionActionResult]
828
829
class MutateConversionActionResult:
830
resource_name: str
831
conversion_action: ConversionAction
832
833
class UploadConversionsResponse:
834
partial_failure_error: Status
835
results: List[ConversionUploadResult]
836
job_id: int
837
838
class ConversionUploadResult:
839
conversion_date_time: str
840
conversion_action: str
841
order_id: str
842
843
class UploadCallConversionsResponse:
844
partial_failure_error: Status
845
results: List[CallConversionResult]
846
847
class UploadClickConversionsResponse:
848
partial_failure_error: Status
849
results: List[ClickConversionResult]
850
job_id: int
851
852
class UploadConversionAdjustmentsResponse:
853
partial_failure_error: Status
854
results: List[ConversionAdjustmentResult]
855
job_id: int
856
```