Empty Error on Call Conversion Upload

119 views
Skip to first unread message

Austin Pena

unread,
May 20, 2021, 5:28:02 PM5/20/21
to AdWords API and Google Ads API Forum
Error
Partial error ocurred: ''
Uploaded call conversion that occurred at '2021-04-20 09:00:00-04:00' for caller ID '+141369347--' to the conversion action with resource name 'customers/27548034--/conversionActions/593803131'.

You're reading that right, no error message.


Any ideas? Here's my code:

import os, csv

from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException


def main(client, data):
"""Imports offline call conversion values for calls related to your ads.

Args:
client: An initialized GoogleAdsClient instance.
customer_id: The client customer ID string.
conversion_action_id: The ID of the conversion action to upload to.
caller_id: The caller ID from which this call was placed. Caller ID is
expected to be in E.164 format with preceding '+' sign,
e.g. '+16502531234'.
call_start_date_time: The date and time at which the call occurred. The
format is 'yyyy-mm-dd hh:mm:ss+|-hh:mm',
e.g. '2021-01-01 12:32:45-08:00'.
conversion_date_time: The the date and time of the conversion (should be
after the click time). The format is 'yyyy-mm-dd hh:mm:ss+|-hh:mm',
e.g. '2021-01-01 12:32:45-08:00'.
conversion_value: The conversion value in the desired currency.
"""

# Get the ConversionUploadService client.
conversion_upload_service = client.get_service("ConversionUploadService")
call_conversions = []
for item in data:
customer_id = item[0]
conversion_action_id = item[1]
caller_id = item[2]
call_start_date_time = item[3]
conversion_date_time = item[4]
conversion_value = item[5]

# Create a call conversion in USD currency.
call_conversion = client.get_type("CallConversion")
call_conversion.conversion_action = client.get_service(
"ConversionActionService"
).conversion_action_path(customer_id, conversion_action_id)
call_conversion.caller_id = caller_id
call_conversion.call_start_date_time = call_start_date_time
call_conversion.conversion_date_time = conversion_date_time
call_conversion.conversion_value = conversion_value
call_conversion.currency_code = "USD"

call_conversions.append(call_conversion)

# Issue a request to upload the call conversion.
request = client.get_type("UploadCallConversionsRequest")
request.customer_id = customer_id
request.conversions = call_conversions
request.partial_failure = True
upload_call_conversions_response = (
conversion_upload_service.upload_call_conversions(request=request)
)

# Print any partial errors returned.
if upload_call_conversions_response.partial_failure_error:
print(
"Partial error ocurred: "
f"'{upload_call_conversions_response.partial_failure_error.message}'"
)

# Print the result if valid.
uploaded_call_conversion = upload_call_conversions_response.results[0]
if uploaded_call_conversion.call_start_date_time:
print(
"Uploaded call conversion that occurred at "
f"'{uploaded_call_conversion.call_start_date_time}' "
f"for caller ID '{uploaded_call_conversion.caller_id}' "
"to the conversion action with resource name "
f"'{uploaded_call_conversion.conversion_action}'."
)


if __name__ == "__main__":
# GoogleAdsClient will read the google-ads.yaml configuration file in the
# home directory if none is specified.
application_path = os.path.abspath(os.path.dirname(__file__))
googleads_client = GoogleAdsClient.load_from_storage(version="v7",
path=os.path.join(application_path, 'google-ads.yaml'))

# data = list(csv.reader(open(os.path.join(application_path, 'offline-call-conversions.csv'))))

data = [
[
'27548034--', # Customer ID
'593803131', # conversion_action_id - This had to be an "import" action
'+186093842--', # caller_id
'2021-05-04 19:00:00-04:00', # call_start_time
'2021-05-05 19:32:55-04:00', # conversion_time, optional
50.45 # conversion_value, optional
]
]

main(googleads_client, data)

Austin Pena

unread,
May 20, 2021, 5:28:36 PM5/20/21
to AdWords API and Google Ads API Forum
This is all Google ADs api, not adwords api.

Google Ads API Forum Advisor Prod

unread,
May 21, 2021, 12:47:16 PM5/21/21
to m...@austinpena.com, adwor...@googlegroups.com
Hi Austin,

Thank you for bringing this issue to our attention. I would first ask if you have looked into this section about handling the partial error message as it talks about this specifically. Also would suggest to look into the checking of the empty response as shown here . Also, it would look like you would need to pass in the caller_id into the def main as shown here in this sample.

Regards,
Google Logo
William Pescherine
Google Ads API Team
 


ref:_00D1U1174p._5004Q2HCYnn:ref

Austin Pena

unread,
May 21, 2021, 1:05:40 PM5/21/21
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com
Thanks so much!
Reply all
Reply to author
Forward
0 new messages