How to link an existing Adwords account with MCC Account

775 views
Skip to first unread message

brst...@gmail.com

unread,
Feb 13, 2014, 7:39:39 AM2/13/14
to adwor...@googlegroups.com

Hello everyone,

I am currently developing a web application which requires to add existing adwords user account with the MCC account, this has have to be done using adwords api.
Is there any way this can be done ??
I am using PHP client Library.

Ray Tsang (AdWords API Team)

unread,
Feb 13, 2014, 12:08:32 PM2/13/14
to adwor...@googlegroups.com
Hi,

Please take a look at this slide and the Managing Customer Accounts guide.

Cheers,

--
Ray Tsang (AdWords API Advisor)

brst...@gmail.com

unread,
Feb 14, 2014, 9:55:36 AM2/14/14
to adwor...@googlegroups.com
Hey Ray Tsang, Many thanks for the reply.

Now looking at the links you have provided to me it was a little difficult for me to convert the code snippet(provided in java)  to PHP but some how i have managed to create a function described below.

function LinkExistingAdwordsAccoount(AdWordsUser $user) {

    $managedCustomerService = $user->GetService('ManagedCustomerService', ADWORDS_VERSION);
    $customer = new ManagedCustomerLink();   
    $customer->managerCustomerId = "XXXX499577";
    //$customer->clientCustomerId = "XXXX313836";
    $customer->clientCustomerId = "2823209189";
    $customer->linkStatus = "PENDING";
    //$customer->pendingDescriptiveName = "";
   
     // Create operation.
    $operation = new LinkOperation();
    $operation->operator = 'ADD';
    $operation->operand = $customer;
    //$operation->OperationType = $OperationType;

    $operations = array($operation);
    echo "<pre>";
    print_r($operations);
    // Make the mutate request.
    $result = $managedCustomerService->mutateLink($operations);
    
    print_r($result);
}

The following was the result:

Array
(
    [0] => LinkOperation Object
        (
            [operand] => ManagedCustomerLink Object
                (
                    [managerCustomerId] => XXXX499577
                    [clientCustomerId] => XXXX209189
                    [linkStatus] => PENDING
                    [pendingDescriptiveName] => 
                )

            [operator] => ADD
            [OperationType] => 
            [_parameterMap:Operation:private] => Array
                (
                    [Operation.Type] => OperationType
                )

        )

)
MutateLinkResults Object
(
    [links] => Array
    (
        [0] => ManagedCustomerLink Object
        (
            [managerCustomerId] => XXXX499577
            [clientCustomerId] => XXXX209189
            [linkStatus] => PENDING
            [pendingDescriptiveName] =>
        )
    )
)

Now This was a successful request because i have checked it by hitting twice and i got the following result

Array
(
    [0] => LinkOperation Object
        (
            [operand] => ManagedCustomerLink Object
                (
                    [managerCustomerId] => XXXX499577
                    [clientCustomerId] => XXXX209189
                    [linkStatus] => PENDING
                    [pendingDescriptiveName] => 
                )

            [operator] => ADD
            [OperationType] => 
            [_parameterMap:Operation:private] => Array
                (
                    [Operation.Type] => OperationType
                )

        )

)
An error has occurred: [ManagedCustomerServiceError.ALREADY_INVITED_BY_THIS_MANAGER @ operations[0]]

Now looking at the response i am assuming that the request has been gone to the required reciver BUT when loging in with the clientCustomerId credentials i did not found any email for the invitation.
Is anything Wrong here?? Please guide me.
Again many thanks for the reply.
Thanks!

Message has been deleted

brst...@gmail.com

unread,
Feb 14, 2014, 10:11:13 AM2/14/14
to adwor...@googlegroups.com
hey Ray Tsang, many thanks for the reply.

Now looking at the above links which you have provided to me i was a little difficult for me to convert the code snippet(provided in java) to PHP but some how i have managed to do so and come up with a function, provided in the attach file, Please have a look.

The function worked for me and in response there was an MutateLinkResults Object. Now to confirm that the invitation request has been sent successfully i again hit the same file and got this response

An error has occurred: ManagedCustomerServiceError.ALREADY_INVITED_BY_THIS_MANAGER

So if the request was rite then why the clientCustomerId did'nt recieved an invitation email ??

Again many thanks for the reply and would like to hear from you in future.

Ray Tsang (AdWords API Team)

unread,
Feb 14, 2014, 3:57:50 PM2/14/14
to adwor...@googlegroups.com
Hi,

Could I trouble you to elaborate what you meant by "why the clientCustomerId did'nt recieved an invitation email ??"?
Are you referring to an actual email?  Or is the invitation not showing up in the AdWords UI?  Or, did you mean that it didn't show up in via the AdWords API?

Thanks!

--
Ray Tsang (AdWords API Advisor)

brst...@gmail.com

unread,
Feb 17, 2014, 1:18:55 AM2/17/14
to adwor...@googlegroups.com
hello Ray Tsang,

yes i can explain this. Look when we are logged in to the MCC then there are two buttons(create Account,link existing account) under Accounts tab. So when we link an existing account we provide the email address of the user and an automated email with an acceptance link is sent to the user. The user then clicks that link and after that his account is linked.
I simply thought in this way only for linking a user account(clientCustomerId) through Adwords Api. But the process is somewhat different. Actually i have to send two requests the first one with parameter ADD PENDING and if this request is successful then another request SET ACTIVE in order to link the other user account with my account.

Well thanks Ray Tsang for listening to my problems and providing me the solutions and i hope the same in near future.

brst...@gmail.com

unread,
Feb 17, 2014, 9:44:57 AM2/17/14
to adwor...@googlegroups.com

hello Ray Tsang,
yes i can explain this. See if you have a look at the User Interface of My client center account and switch to accounts tab then there are two buttons create account and link existing account. If we click on link existing Account then we have to provide the email of the adwords user whom we want to link, then an automated email is sent to the user with invitation link and if the user click this link then his account is linked with our account. I thought in this similar way but if we are adding an existing user through adwords api the we have to make two request the first one with ADD PENDING and the second request is SET ACTIVE. After these two requests the account is linked.

Now i have this problem that if i want to query about any of my client (which is currently added in my list) then i have to add clientCustomerId = "XXX-378-1467" parameter in my auth.ini file and after that i can fetch Campaings,add campaings etc.. Now is there any way how to make this clientCustomerId dynamic ??

The second question is that whenever i want to fetch any of the information about a user then can i send the clientCustomerId in my request instead of initialising it in auth.ini file ?

Ray Tsang (AdWords API Team)

unread,
Feb 17, 2014, 10:45:37 AM2/17/14
to adwor...@googlegroups.com
Yes,

Client customer ID can be set dynamically.  It sounds like you are using the PHP client library.
Please see if SetClientCustomerId on the AdWordsUser class:

Thanks,

Ray

brst...@gmail.com

unread,
Feb 18, 2014, 10:29:13 AM2/18/14
to adwor...@googlegroups.com
hello Ray Tsang,

Well thankyou so much for your support. I have been able to set Developer Token,Client Customer Id and User Agent dynamically.
Now  proceeding further i have to show the reporting to the users. Now in the PHP Client Library under examples/Reporting i have files and after running them i have the desired output in the format i want. now is there any way i can fetch the reporting in xml format instead of downloading the file i want the response in XML format so that i can convert it into array and show the fields to the user.

Thanks!

Ray Tsang (AdWords API Team)

unread,
Feb 19, 2014, 4:48:36 AM2/19/14
to adwor...@googlegroups.com
Hi,

You are welcome!  Glad I was helpful.  Please visit the reporting basic guide, you can use the XML format.  PHP Client library has a way to set the report format.  Please see this example.

Thanks,

Ray

brst...@gmail.com

unread,
Mar 10, 2014, 10:58:22 AM3/10/14
to adwor...@googlegroups.com
hello Ray Tsang,

Now i have stuck in a new problem : How to update existing keywords text ? I have the creation Id and i am using the service AdGroupCriterionService.mutate but still not able to figure out how can i change the text of the existing keywords. looking forward for you help!
Thanks!

Ray Tsang (AdWords API Team)

unread,
Mar 10, 2014, 11:17:59 AM3/10/14
to adwor...@googlegroups.com
Hi,

I'd recommend starting a new thread for a new topic.  Please start a new thread with new details and if you have received an errors.
In short, you should be able to update a criterion, and/or remove existing keywords and adding newly updated ones.

Cheers,

Ray
Reply all
Reply to author
Forward
0 new messages