Hi Albin,
Thank you for reaching out. I think you have misunderstood the two concepts here. The login_customer_id has to be set in the configuration file and it eventually will be used in the request header. For the resource, you have to use the client customer id in the format of customers/{customer_id}/adGroups/{ad_group_id} to trace down to the lowest level entity. The client customer id could be set in a way such as in this example.
Thanks and regards,
Xiaoming, Google Ads API Team
|
||||||
Hi Xiaoming,
Thanks for getting back to me, I am currently working with python, would this be a way of stating the customer_id for the header?
credentials = {
'developer_token': ‘XXXX’,
'refresh_token': 'XXXX',
'client_id': ‘XXXX’,
'client_secret': ‘XXXX',
'customer_id' : <master_mcc_no>}
client = GoogleAdsClient.load_from_dict(credentials)
What I am actually trying to do is that I want to update all bid modifiers for Gender and Location across an account. I have been struggling quiet a bit, so would appreciate if you could point me into a direction for that. First off, I am trying to get the example for mobile devices to work, which so far has been unsuccessful. I have been banging my head against the wall with this – so would appreciate some input if you have any! 😊
Please see my attached code below
credentials = {
'developer_token': ‘XXXX’,
'refresh_token': 'XXXX ',
'client_id': ‘XXXX',
'client_secret': ‘XXXX',
'customer_id' : <master_mcc_no>}
client = GoogleAdsClient.load_from_dict(credentials)
customer_id = "XXXX"
campaign_id = "XXXX"
ad_group_id = "XXXX"
ad_group_service = client.get_service("AdGroupService", version="v6")
ad_group_bm_service = client.get_service(
"AdGroupBidModifierService", version="v6"
)
# Create ad group bid modifier for mobile devices with the specified ad
# group ID and bid modifier value.
ad_group_bid_modifier_operation = client.get_type(
"AdGroupBidModifierOperation"
)
ad_group_bid_modifier = ad_group_bid_modifier_operation.create
# Set the ad group.
ad_group_bid_modifier.ad_group = ad_group_service.ad_group_path(
customer_id, ad_group_id
)
# Set the bid modifier.
ad_group_bid_modifier.bid_modifier = 1.1
# Sets the device.
ad_group_bid_modifier.device.type = client.get_type(
"DeviceEnum", version="v6"
).MOBILE
# Add the ad group bid modifier.
ad_group_bm_response = ad_group_bm_service.mutate_ad_group_bid_modifiers(customer_id, [ad_group_bid_modifier_operation])
Best regards,
Albin