How to tell if an account is MCC or non-MCC (client)

1,158 views
Skip to first unread message

Lena Madenci

unread,
Jan 5, 2016, 3:48:05 PM1/5/16
to AdWords API Forum
I've been reading the docs on ManagedCustomerService and I am having issue understanding how to tell if a returned entity is a manager account or a client account. 
Is there any API call used for this, so that I can determine an Adwords user's account type based on a client_customer_id, for example? 

Thanks

Yin Niu

unread,
Jan 5, 2016, 3:55:27 PM1/5/16
to AdWords API Forum
Hi Lena, 

You could check the canManageClients field of ManagedCustomer

Thanks,
Yin, AdWords API Team. 

Lena Madenci

unread,
Jan 6, 2016, 12:01:37 PM1/6/16
to AdWords API Forum
I have tried using canManageClients, however, when the account I am finding clients with is a Manager account, canManageClients returns true for all accounts, including accounts that I know are non-MCC accounts.

Yin Niu

unread,
Jan 6, 2016, 12:50:41 PM1/6/16
to AdWords API Forum
Hello, 

The code below checks the CanManageClients field. It should return true for MCC account and false for client account. 

    SelectorBuilder builder = new SelectorBuilder();
    Selector selector = builder
        .fields(ManagedCustomerField.CustomerId, ManagedCustomerField.Name, ManagedCustomerField.CanManageClients,               ManagedCustomerField.TestAccount)
        .orderAscBy(CampaignField.Name)
        .offset(offset)
        .limit(PAGE_SIZE)
        .build();

    ManagedCustomerPage page = null;
    do {
      page = managedCustomerService.get(selector);

      if (page.getEntries() != null) {
        for (ManagedCustomer managedCustomer : page.getEntries()) {
          
          System.out.println("Managed Customer with with name \"" + managedCustomer.getName() + "\" and id \""
              + managedCustomer.getCustomerId() + "\" was found.");
          System.out.println("Can manage clients: " + managedCustomer.getCanManageClients());
          System.out.println("Is Test account: " + managedCustomer.getTestAccount());
        }
      } else {
        System.out.println("No managed customers were found.");
      }

      offset += PAGE_SIZE;
      selector = builder.increaseOffsetBy(PAGE_SIZE).build();
    } while (offset < page.getTotalNumEntries());


If this doesn't work, please send your client CustomerID and the SOAP request and response. Please click Reply privately to author in the forum when responding.

James Andrews

unread,
Jan 6, 2016, 2:52:02 PM1/6/16
to AdWords API Forum
Hello Yin,

I'm working with Lena and we're using php not python.  From looking at what you provide I believe it coded correctly in php.  This is what we have.

        // Function to get the adwords user from credentials
        $user = $this->getAdwordsUser($account, $params);

        // Get the adwords customer
        $customerService = $user->GetService("CustomerService");
        $customer = $customerService->get();

        $user->SetClientCustomerId($customer->customerId);

        $customerService = $user->GetService("CustomerService");
        $customer = $customerService->get();

        $managedCustomerService = $user->GetService('ManagedCustomerService', ADWORDS_VERSION);
        // Create selector.
        $selector = new \Selector();
        // Specify the fields to retrieve.
        $selector->fields = array('CustomerId', 'Name', 'CanManageClients');
        // Make the get request.
        $managedCustomerPage = $managedCustomerService->get($selector);

Does this look right?  Can you see anything we are doing incorrectly?

Thanks,
James

Yin Niu

unread,
Jan 6, 2016, 3:05:05 PM1/6/16
to AdWords API Forum
Hi, 

Code looks fine to me.  

Please send your client CustomerID and the SOAP request and response. Please click Reply privately to author in the forum when responding.
Reply all
Reply to author
Forward
0 new messages