clientCustomerId in googleads-php-lib v25

132 views
Skip to first unread message

Steve Bradburn

unread,
Apr 19, 2017, 10:31:39 AM4/19/17
to AdWords API Forum
Hi,

We've been using googleads-php-lib successfully for some time for reporting purposes, and we're now upgrading to v25. 

However, I'm trying to find how to change the clientCustomerId. In the previous version we could set up a client and then use SetClientCustomerId() to define which child account we were reporting on. Now we seem to be building it into the AdWordsSessionBuilder() and I can't see any way to change it subsequent to this - am I missing something?

The previous code examples (e.g.googleads-php-lib/examples/AdWords/v201702/Reporting/DownloadCriteriaReport.php under tag 17.0.0) included the ability to "Set clientCustomerId to get reports of your child accounts" (although it was commented out in the example). The latest version of this example (under 25.3.0) does not appear to allow you to set the report to any child account - I'm supposing that you need to build the client with the specific clientCustomerID?

Is there a way to log in to our own account and specify a child account for reporting?

Shwetha Vastrad (AdWords API Team)

unread,
Apr 19, 2017, 10:46:36 AM4/19/17
to AdWords API Forum
Hi Steve,

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

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

The ParallelReportDownload PHP example shows how to construct an API session for the specified client customer ID.

Regards,
Shwetha, AdWords API Team.

Steve Bradburn

unread,
Apr 20, 2017, 7:14:39 AM4/20/17
to AdWords API Forum
Hi Shwetha,

I hadn't realised that the session could be rebuilt as and when, that makes more sense now. Many thanks for your help.

Steve
Reply all
Reply to author
Forward
0 new messages