[PHP SDK] - How to change the clientCustomerId on the new SDK

650 views
Skip to first unread message

Arce Yazilim

unread,
Feb 14, 2017, 9:29:54 AM2/14/17
to AdWords API Forum, gokha...@arceyazilim.com, sa...@arceyazilim.com, in...@arceyazilim.com

Hello,

I could change the customer id on the old SDK as below.

$user = new AdWordsUser ();
$user->LogAll ();
$user->SetClientCustomerId (1111111); // <---- this one

I have not found out how to do this on the new SDK. We need to change this value because there are multiple users who use our advertising panel. How are we going to do?

$session = (new AdWordsSessionBuilder ())
->fromFil ()
->withOAuth2Credential($oAuth2Credential)
->build ();

$dession->SetClientCustomerId (111111); // <---- like this

Thnx.

Shwetha Vastrad (AdWords API Team)

unread,
Feb 14, 2017, 12:18:26 PM2/14/17
to AdWords API Forum, gokha...@arceyazilim.com, sa...@arceyazilim.com, in...@arceyazilim.com
Hi,

You can set the clientCusotmerId while creating an AdWords session as shown below:

    $session = (new AdWordsSessionBuilder())
        ->fromFile()
        ->withOAuth2Credential($oAuth2Credential)
        ->withClientCustomerId(clientCustomerId)
        ->build();

Regards,
Shwetha, AdWords API Team.

Arce Yazilim

unread,
Feb 15, 2017, 2:23:13 AM2/15/17
to AdWords API Forum, gokha...@arceyazilim.com, sa...@arceyazilim.com, in...@arceyazilim.com
We thank you. He works like we want.

14 Şubat 2017 Salı 20:18:26 UTC+3 tarihinde Shwetha Vastrad (AdWords API Team) yazdı:

Vladimir Tatarsky

unread,
May 19, 2017, 3:00:42 PM5/19/17
to AdWords API Forum, gokha...@arceyazilim.com, sa...@arceyazilim.com, in...@arceyazilim.com
Hi guys, is that possible to set Client customer ID dynamically? i.e. without building new session every time

Shwetha Vastrad (AdWords API Team)

unread,
May 19, 2017, 4:42:53 PM5/19/17
to AdWords API Forum, gokha...@arceyazilim.com, sa...@arceyazilim.com, in...@arceyazilim.com
Hi Vladimir,

You need to use the AdWordsSessionBuilder to build a session for a specific clientCustomerId as shown here. I'm afraid there isn't a method available to set the clientCustomerId once the session built. 

Vladimir Tatarsky

unread,
May 24, 2017, 6:35:10 AM5/24/17
to AdWords API Forum, gokha...@arceyazilim.com, sa...@arceyazilim.com, in...@arceyazilim.com
Ok, just another question (sorry for off-topic): is that possible to build session and OAuth credential object without calling "fromFile" method?

Shwetha Vastrad (AdWords API Team)

unread,
May 24, 2017, 12:02:28 PM5/24/17
to AdWords API Forum, gokha...@arceyazilim.com, sa...@arceyazilim.com, in...@arceyazilim.com
Hi Vladimir,

You can provide the OAuth2 configuration details while building the OAuth2 credentials and session object. Please see OAuth2TokenBuilder.php and AdWordsSessionBuilder.php for the available options. An example is provided here which shows how to use the OAuth2TokenBuilder without using the fromFile() method. 
Reply all
Reply to author
Forward
0 new messages