login-customer-id is a new required
header in Google Ads API when using a manager account to access an operating customer
account. If accessing an operating customer account directly, the
login-customer-id header is not required.
If the authenticated user has access to both the manager and operating customer
login-customer-id should be specified to avoid any ambiguity.
Though not specifying
login-customer-id would still work in this case, the
context is set to the operating customer account only (which is probably not
what is intended).
If you've been managing accounts with just OAuth2
of a manager account, follow these steps to obtain the correct
List accessible customers
Use the ListAccessibleCustomers example to generate the list of all customers accessible using the OAuth2 credentials that you supplied. As mentioned on that page, only customers that are directly accessible will be returned. Both manager and operating customer accounts could be returned.
Determine manager account hierarchy
For each manager account returned in step 1, use the GetAccountHierarchy example to determine its accounts hierarchy.
Note that if you run the
GetAccountHierarchyexample without specifying a
login-customer-id, it will perform step 1 for you.
Select the appropriate manager account
If there are multiple manager accounts for a given operating customer account, select the manager account at the top of the hierarchy. This lets you maintain the same
login-customer-idfor multiple calls throughout the hierarchy of accounts and thereby avoid excessive switching.
The exceptions to this rule are cases such as billing where selecting a specific manager account is necessary.