Hello everyone,

We are trying to upload Google Ads conversions from our custom application 
to the Google Ads account of one of our customers, but we are facing some 
issues.
 
It seems that when we try to use the GoogleAds Python Library to submit a 
conversion the API responds with an authentication error:





*partial_failure_error {  code: 3  message: "The click from the imported 
event is associated with a different Google Ads account. Make sure you\'re 
importing to the correct account..."  ...}*

It might seem that the customer_id we used in our request would not be the 
correct one, so we used the SearchGoogleAds service to identify to which 
account and campaign the Google Click ID belongs to, but from the response 
it seems that it belongs to a campaign from the same customer_id that we 
are using.

This is the code we used for that:







*ga_service = client.get_service("GoogleAdsService")search_request = 
client.get_type("SearchGoogleAdsStreamRequest")search_request.customer_id = 
customer_idquery = f"SELECT campaign.id, campaign.name, campaign.status, 
click_view.gclid, click_view.campaign_location_target FROM click_view where 
click_view.gclid = 'XXXX' AND segments.date = 
'2024-08-05'"search_request.query = querystream = 
ga_service.search_stream(search_request)for batch in stream:    
print(batch)*

To complicate things further, our customer told us that they have a manager 
account for that base account we were using, so we might have to use the 
manager account for submitting the conversion instead, but when we use it 
we get a different error, in this case a GoogleAdsException with the 
following error:




*  error_code {    authorization_error: USER_PERMISSION_DENIED  }  message: 
"User doesn\'t have permission to access customer. Note: If you\'re 
accessing a client customer, the manager\'s customer id must be set in the 
\'login-customer-id\' header. See 
https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid"}*
Following the advice of the error message we tried to include the manager 
account customer_id as a header in the upload request:















*conversion_action_id = 'XXXXX'click_conversion = 
client.get_type("ClickConversion")conversion_action_service = 
client.get_service("ConversionActionService")click_conversion.conversion_action 
= conversion_action_service.conversion_action_path(    client_id, 
conversion_action_id)click_conversion.gclid = 
'YYYYY'click_conversion.conversion_value = 
0click_conversion.conversion_date_time = ('2024-08-07 
14:11:00+03:00')client.login_customer_id = 'ZZZZZ' # manager account 
idconversion_upload_service = 
client.get_service("ConversionUploadService")request = 
client.get_type("UploadClickConversionsRequest")request.customer_id = 
'WWWWW' # base account idrequest.conversions = 
[click_conversion]request.partial_failure = 
Trueconversion_upload_service.upload_click_conversions(request=request)*
But that does not seem to have any effect as we get the same error:




* error_code {    authorization_error: USER_PERMISSION_DENIED  }  message: 
"User doesn\'t have permission to access customer. Note: If you\'re 
accessing a client customer, the manager\'s customer id must be set in the 
\'login-customer-id\' header. See 
https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid"}*

Any ideas of what we might be doing wrong? 

   - Is this the correct way to set-up the header from the Google Ads 
   Python Library?
   - Is the query we used to find out to which campaign and account the 
   collected click id belongs to correct?

In case it helps, we found a similar issue 
<https://groups.google.com/g/adwords-api/c/Mg2vNCVeHz4/m/QxgMn2g-AgAJ> in 
the forum, but using the query they suggest we confirmed that the base 
account we are using has as manager account the other customer_id our 
customer provided us with:

*results {*

*  customer {*

*    resource_name: "customers/XXXXX"*

*    conversion_tracking_setting {*

*      conversion_tracking_id: YYYYYY*

*      cross_account_conversion_tracking_id: ZZZZZZZ*

*      conversion_tracking_status: 
CONVERSION_TRACKING_MANAGED_BY_ANOTHER_MANAGER*

*      google_ads_conversion_customer: "customers/WWWWWW"*

*    }*

*  }*

*}*

*field_mask {*

*  paths: "customer.conversion_tracking_setting.conversion_tracking_id"*

*  paths: "customer.conversion_tracking_setting.conversion_tracking_status"*

*  paths: 
"customer.conversion_tracking_setting.cross_account_conversion_tracking_id"*

*  paths: 
"customer.conversion_tracking_setting.google_ads_conversion_customer"*

*}*

*request_id: "xxxxx"*

*query_resource_consumption: 94*

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6ca7a3a7-3b65-440b-bfda-4edb3d1c0be7n%40googlegroups.com.
  • Er... Gonzalo Rubio
    • ... Gonzalo Rubio
      • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to