login_customer_id, cannot access resources further down the hierarchy

76 views
Skip to first unread message

Albin Kristiansson

unread,
Feb 12, 2021, 4:30:24 AM2/12/21
to AdWords API and Google Ads API Forum
Hi,

I am work in a setting where I have multiple levels in the hierarchy, from the master MCC down to client level.

I understand that the login_customer_id has to be set the the ID of the master account

"This is the customer ID of the authorized customer to use in the request, without hyphens (-). If your access to the customer account is through a manager account, this header is required and must be set to the customer ID of the manager account."

So I set the customer ID on master MCC level (manager account), what then becomes the problem is that I cannot access resources (in this case and ad group)

errors { error_code { mutate_error: RESOURCE_NOT_FOUND } message: "Resource was not found." trigger { int64_value: XXXXXX   } location { field_path_elements { field_name: "operations" index: 0 } field_path_elements { field_name: "create" } field_path_elements { field_name: "ad_group" } } }

Where XXXXXX  is the ID of the adgroup.

I have a feeling that I might be having trouble finding resources when setting the customer id to the top level MCC (manager account).

Would appreciate some input if anyone has some,

Cheers,

Albin Kristiansson

unread,
Feb 12, 2021, 5:01:02 AM2/12/21
to AdWords API and Google Ads API Forum

it would be nice to have something like SetClientCustomerId like in the adwords API

Google Ads API Forum Advisor Prod

unread,
Feb 12, 2021, 3:30:03 PM2/12/21
to albin.kri...@groupm.com, adwor...@googlegroups.com

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
 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2CQKJZ:ref

Albin Adam Kristiansson

unread,
Feb 15, 2021, 2:44:21 AM2/15/21
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com

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

Privileged/Confidential Information may be contained in this message. If you are
not the addressee indicated in this message (or responsible for delivery of the
message to such person), you may not copy or deliver this message to anyone. In
such case, you should destroy this message and kindly notify the sender by reply
email. Please advise immediately if you or your employer does not consent to email
for messages of this kind. Opinions, conclusions and other information in this
message that do not relate to the official business of Group M Worldwide LLC and/or
other members of the GroupM group of companies shall be understood as neither given
nor endorsed by it. GroupM is the global media investment management arm of WPP.
For more information on our business ethical standards and Corporate Responsibility
policies please refer to WPP's website at http://www.wpp.com/WPP/About/
Reply all
Reply to author
Forward
0 new messages