Issues of enhancement conversion

153 views
Skip to first unread message

Eric Xu

unread,
Apr 12, 2024, 3:29:36 AM4/12/24
to Google Ads API and AdWords API Forum
Hello teams, after many times tried, our api upload enhancement conversion still not work.
I will share my code demo & response below, if u need more details ,pls reply:

Code:
import hashlib
import logging
from google.ads.googleads.client import GoogleAdsClient

logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s - %(levelname)s] %(message).5000s')
logging.getLogger('google.ads.googleads.client').setLevel(logging.DEBUG)


def normalize_and_hash(s):
return hashlib.sha256(s.strip().lower().encode()).hexdigest()


# 初始化client
client = GoogleAdsClient.load_from_storage("/Users/eric/PycharmProjects/google_ads/google-ads.yaml")

# Constructs the enhancement adjustment.
conversion_adjustment = client.get_type("ConversionAdjustment")
conversion_adjustment.adjustment_type = (
client.enums.ConversionAdjustmentTypeEnum.ENHANCEMENT
)

# add phone
phone_identifier = client.get_type("UserIdentifier")
phone_identifier.hashed_phone_number = normalize_and_hash("+919820703373")
conversion_adjustment.user_identifiers.append(phone_identifier)

# add order_id
conversion_adjustment.order_id = "37656781"

# add gclid & conversion_date_time
conversion_adjustment.gclid_date_time_pair.conversion_date_time = "2024-04-12 15:07:12+08:00"
conversion_adjustment.gclid_date_time_pair.gclid = "CjwKCAjwt-OwBhBnEiwAgwzrUui8sK_o-3d-GO_u4VuC9Gzr6wUk_dXJKi-m9uMf2DbXLYMgfCqpDhoChN4QAvD_BwE"

# find conversion action
conversion_action_service = client.get_service("ConversionActionService")
conversion_adjustment.conversion_action = (conversion_action_service.conversion_action_path(7514302876, 6731257876))

# Creates the conversion adjustment upload service client.
conversion_adjustment_upload_service = client.get_service("ConversionAdjustmentUploadService")

response = conversion_adjustment_upload_service.upload_conversion_adjustments(
customer_id="7514302876",
conversion_adjustments=[conversion_adjustment],
partial_failure=True,
)

Response:
[2024-04-12 15:29:05,999 - DEBUG] Making request: POST https://accounts.google.com/o/oauth2/token
[2024-04-12 15:29:06,006 - DEBUG] Starting new HTTPS connection (1): accounts.google.com:443
[2024-04-12 15:29:07,037 - DEBUG] https://accounts.google.com:443 "POST /o/oauth2/token HTTP/1.1" 200 None
[2024-04-12 15:29:08,940 - DEBUG] Request
-------
Method: /google.ads.googleads.v16.services.ConversionAdjustmentUploadService/UploadConversionAdjustments
Host: googleads.googleapis.com
Headers: {
  "developer-token": "REDACTED",
  "login-customer-id": "7514302876",
  "x-goog-api-client": "gl-python/3.9.6 grpc/1.62.0 gax/2.17.1 gccl/23.1.0 pb/4.25.3",
  "x-goog-request-params": "customer_id=7514302876"
}
Request: customer_id: "7514302876"
conversion_adjustments {
  gclid_date_time_pair {
    gclid: "CjwKCAjwt-OwBhBnEiwAgwzrUui8sK_o-3d-GO_u4VuC9Gzr6wUk_dXJKi-m9uMf2DbXLYMgfCqpDhoChN4QAvD_BwE"
    conversion_date_time: "2024-04-12 15:07:12+08:00"
  }
  order_id: "37656781"
  conversion_action: "customers/7514302876/conversionActions/6731257876"
  adjustment_type: ENHANCEMENT
  user_identifiers {
    hashed_phone_number: "95a6ed9f3d36ed8b892fbd689818489f63535fb3de0529e94570a8366b1355b5"
  }
}
partial_failure: true


Response
-------
Headers: {
  "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
  "content-disposition": "attachment",
  "date": "Fri, 12 Apr 2024 07:29:08 GMT",
  "request-id": "3RvYVBDBP6zMlpX5VhCodg"
}
Response: partial_failure_error {
  code: 3
  message: "Can\'t use enhanced conversions with the specified conversion action., at conversion_adjustments[0].conversion_action"
  details {
    type_url: "type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure"
    value: "\n\263\001\n\003\230\007\020\022DCan\'t use enhanced conversions with the specified conversion action.\0323*1customers/7514302876/conversionActions/6731257876\"1\022\032\n\026conversion_adjustments\030\000\022\023\n\021conversion_action"
  }
}
results {
}
job_id: 8562845044805615846


[2024-04-12 15:29:08,941 - INFO] Request made: ClientCustomerId: 7514302876, Host: googleads.googleapis.com, Method: /google.ads.googleads.v16.services.ConversionAdjustmentUploadService/UploadConversionAdjustments, RequestId: 3RvYVBDBP6zMlpX5VhCodg, IsFault: False, FaultMessage: None


Google Ads API Forum Advisor

unread,
Apr 15, 2024, 12:57:13 AM4/15/24
to eric...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

Upon checking the provided logs, I understand that you are encountering 'CONVERSION_ACTION_NOT_ELIGIBLE_FOR_ENHANCEMENT' error, could you please confirm that you have already considered the Validation rules in Upload Conversion Adjustments and you have followed the setup and configuration steps for Implementing Enhanced Conversions for Web

Also, you must specify the order_id in the ConversionAdjustment under any of these conditions:

  • The type of the conversion action is equal to WEBPAGE.

  • The original conversion you are adjusting was assigned an order_id.

You can send the details via Reply privately to the author option, or direct private reply to this email. 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tP3cf:ref" (ADR-00230909)

Thanks,
 
Google Logo Google Ads API Team


Eric Xu

unread,
Apr 15, 2024, 5:07:20 AM4/15/24
to Google Ads API and AdWords API Forum
Hi teams,
before pic shows my code demo, I thought it is correct, I got it from your Google Ads API.
and I also found a strange question:
When I set one  child customer account  manage his own conversion independently, this code will work well,
but once I changed it managed by cross-account conversion management customer, the code doesn't work
I confirmed our configuration set up successfully
This question puzzled me for days, kindly help me to find issues.
I can provide details u needed
very thx!

Google Ads API Forum Advisor

unread,
Apr 17, 2024, 12:45:58 PM4/17/24
to eric...@gmail.com, adwor...@googlegroups.com

Hi,

What do you mean by "the code doesn't work”? Are you getting any API errors here?

If yes, please get back to us with complete API logs (request and response with request-id and request header) generated at your end. So that we can check from our end and assist you accordingly.

If not, please elaborate more on the issue that you are facing when changing to a cross-account. 

Eric Xu

unread,
Apr 17, 2024, 10:38:29 PM4/17/24
to Google Ads API and AdWords API Forum
This is detail logs:


[2024-04-18 10:35:15,204 - DEBUG] Making request: POST https://accounts.google.com/o/oauth2/token
[2024-04-18 10:35:15,210 - DEBUG] Starting new HTTPS connection (1): accounts.google.com:443
[2024-04-18 10:35:16,281 - DEBUG] https://accounts.google.com:443 "POST /o/oauth2/token HTTP/1.1" 200 None
[2024-04-18 10:35:17,891 - DEBUG] Request

-------
Method: /google.ads.googleads.v16.services.ConversionAdjustmentUploadService/UploadConversionAdjustments
Host: googleads.googleapis.com
Headers: {
  "developer-token": "REDACTED",
  "login-customer-id": "7514302876",
  "x-goog-api-client": "gl-python/3.9.6 grpc/1.62.0 gax/2.17.1 gccl/23.1.0 pb/4.25.3",
  "x-goog-request-params": "customer_id=7514302876"
}
Request: customer_id: "7514302876"
conversion_adjustments {
  gclid_date_time_pair {
    gclid: "Cj0KCQjw2uiwBhCXARIsACMvIU09QWMrJlMZEYJJvGkF-EsoswVYsBNdnfuMr9cqC4kdVmd3cQ0TNJQaAtKtEALw_wcB"
    conversion_date_time: "2024-04-14 14:26:19+08:00"
  }
  order_id: "37693845"
  conversion_action: "customers/7514302876/conversionActions/6793797327"
  adjustment_type: ENHANCEMENT
  user_identifiers {
    hashed_phone_number: "384e93de681427a3886d9811f1bc1a080aacfd22f80bbba7126fd8c489d629bd"

  }
}
partial_failure: true


Response
-------
Headers: {
  "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
  "content-disposition": "attachment",
  "date": "Thu, 18 Apr 2024 02:35:17 GMT",
  "request-id": "2I5oafPX0eI_AdJsW8UDyA"

}
Response: partial_failure_error {
  code: 3
  message: "Can\'t use enhanced conversions with the specified conversion action., at conversion_adjustments[0].conversion_action"
  details {
    type_url: "type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure"
    value: "\n\263\001\n\003\230\007\020\022DCan\'t use enhanced conversions with the specified conversion action.\0323*1customers/7514302876/conversionActions/6793797327\"1\022\032\n\026conversion_adjustments\030\000\022\023\n\021conversion_action"
  }
}
results {
}
job_id: 7268831391646773896


[2024-04-18 10:35:17,891 - INFO] Request made: ClientCustomerId: 7514302876, Host: googleads.googleapis.com, Method: /google.ads.googleads.v16.services.ConversionAdjustmentUploadService/UploadConversionAdjustments, RequestId: 2I5oafPX0eI_AdJsW8UDyA, IsFault: False, FaultMessage: None

Google Ads API Forum Advisor

unread,
Apr 18, 2024, 1:25:25 PM4/18/24
to eric...@gmail.com, adwor...@googlegroups.com

Hi,

As you mentioned changed to “cross-account conversion management customer," kindly note that the google_ads_conversion_customer field indicates the Google Ads account that creates and manages conversions for this customer. For customers using cross-account conversion tracking, this is the ID of a manager account. The Google Ads conversion customer ID should be given as the customer_id in Google Ads API requests to create and manage conversions.

You can use the below query to retrieve information about your conversion tracking setup.

  • SELECT
      customer.conversion_tracking_setting.google_ads_conversion_customer,
      customer.conversion_tracking_setting.conversion_tracking_status,
      customer.conversion_tracking_setting.conversion_tracking_id,
      customer.conversion_tracking_setting.cross_account_conversion_tracking_id
    FROM customer

I would recommend that you please check the cross-account conversion tracking behavior with respect to the ConversionActionService.

I hope it helps. 

Eric Xu

unread,
Apr 18, 2024, 11:25:14 PM4/18/24
to Google Ads API and AdWords API Forum
Hi this is my cross-account conversion tracking settings:
log details


[2024-04-19 11:24:05,644 - DEBUG] Making request: POST https://accounts.google.com/o/oauth2/token
[2024-04-19 11:24:05,660 - DEBUG] Starting new HTTPS connection (1): accounts.google.com:443
[2024-04-19 11:24:06,665 - DEBUG] https://accounts.google.com:443 "POST /o/oauth2/token HTTP/1.1" 200 None
[2024-04-19 11:24:08,628 - DEBUG] Request
-------
Method: /google.ads.googleads.v16.services.GoogleAdsService/Search

Host: googleads.googleapis.com
Headers: {
  "developer-token": "REDACTED",
  "login-customer-id": "7514302876",
  "x-goog-api-client": "gl-python/3.9.6 grpc/1.62.0 gax/2.17.1 gccl/23.1.0 pb/4.25.3",
  "x-goog-request-params": "customer_id=2602785452"
}
Request: customer_id: "2602785452"
query: "\nSELECT\n  customer.id,\n  customer.conversion_tracking_setting.google_ads_conversion_customer,\n  customer.conversion_tracking_setting.conversion_tracking_status,\n  customer.conversion_tracking_setting.conversion_tracking_id,\n  customer.conversion_tracking_setting.cross_account_conversion_tracking_id,\n  customer.conversion_tracking_setting.accepted_customer_data_terms\nFROM customer\n"
page_size: 100



Response
-------
Headers: {
  "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
  "content-disposition": "attachment",
  "date": "Fri, 19 Apr 2024 03:24:08 GMT",
  "request-id": "pe8Se6H8TUm2A8OUfGrWqQ"
}
Response: results {
  customer {
    resource_name: "customers/2602785452"
    id: 2602785452
    conversion_tracking_setting {
      conversion_tracking_id: 16492495983
      cross_account_conversion_tracking_id: 11241119912
      accepted_customer_data_terms: true
      conversion_tracking_status: CONVERSION_TRACKING_MANAGED_BY_ANOTHER_MANAGER
      google_ads_conversion_customer: "customers/7514302876"
    }
  }
}
field_mask {
  paths: "customer.id"
  paths: "customer.conversion_tracking_setting.google_ads_conversion_customer"
  paths: "customer.conversion_tracking_setting.conversion_tracking_status"
  paths: "customer.conversion_tracking_setting.conversion_tracking_id"
  paths: "customer.conversion_tracking_setting.cross_account_conversion_tracking_id"
  paths: "customer.conversion_tracking_setting.accepted_customer_data_terms"
}


[2024-04-19 11:24:08,628 - INFO] Request made: ClientCustomerId: 2602785452, Host: googleads.googleapis.com, Method: /google.ads.googleads.v16.services.GoogleAdsService/Search, RequestId: pe8Se6H8TUm2A8OUfGrWqQ, IsFault: False, FaultMessage: None
conversion_tracking_id: 16492495983
cross_account_conversion_tracking_id: 11241119912
accepted_customer_data_terms: true
conversion_tracking_status: CONVERSION_TRACKING_MANAGED_BY_ANOTHER_MANAGER
google_ads_conversion_customer: "customers/7514302876"

Google Ads API Forum Advisor

unread,
Apr 19, 2024, 12:52:53 PM4/19/24
to eric...@gmail.com, adwor...@googlegroups.com

Hi, 

Upon checking the provided logs, I found that you are adjusting the conversion with respect to the resource name ‘customers/7514302876/conversionActions/6793797327’ and through which we got to know that the respective conversion action name is ‘ApiPurchased’ and type is ‘WEBPAGE’.

But when we verified both accounts (7514302876 and 2602785452), we couldn’t find this conversion action in the UI. So could you please provide us the uncropped UI screenshot with clear visibility of the customer ID where you are able to see the conversion action with the name ‘‘ApiPurchased’’? So that we can check the nature of the respective conversion action from our end and assist you accordingly. 

Reply all
Reply to author
Forward
0 new messages