is it possible to get adwords data from AnalyticsService.

140 views
Skip to first unread message

pankaj gurumukhi

unread,
Jan 14, 2016, 9:03:00 AM1/14/16
to AdWords API Forum
The adwords account is linked to the Analytics account and Adwords report can be seen on Analytics UI.
It has been given read access to adwords account. I don't have adwords credentials so can't generate developer token. Using below link I have generated client id, client secret, and refresh token:

https://github.com/googleads/googleads-java-lib/wiki/Using-OAuth2.0

I have kept these value in ads.properties file. Still when I am running below code to create adwords session I am getting error:

GoogleCredential credential = new GoogleCredential.Builder()
                .setTransport(new NetHttpTransport())
                .setJsonFactory(new GsonFactory())
                .setServiceAccountId("************************@*****.gserviceaccount.com")
                .setServiceAccountScopes(scopes)
                .setServiceAccountPrivateKeyFromP12File(
                        new File(
                                "**/**/**/*********.p12"))
                .build();

        AdWordsSession session = new AdWordsSession.Builder()
                .fromFile()
                .withOAuth2Credential(credential).build();

Error: 

Exception in thread "main" A developer token must be set. caused by: [developerToken]
    at com.google.api.ads.adwords.lib.client.AdWordsSession$Builder.validate(AdWordsSession.java:413)
    at com.google.api.ads.adwords.lib.client.AdWordsSession$Builder.build(AdWordsSession.java:389)
    at com.homeunion.analytics.gaevent.GAAdwords.tempMethod(GAAdwords.java:112)
    at com.homeunion.analytics.gaevent.GAAdwords.main(GAAdwords.java:177)

Is it required to login to Adwords account to get developer token.?

Umesh Dengale

unread,
Jan 14, 2016, 11:08:54 AM1/14/16
to AdWords API Forum
Hello,

You could apply for the developer token by login to your manager account (MCC). If you don't have a manager account then please create it and apply for developer token. The developer token is needed to make the AdWords API call. Please check out getting started guide and OAuth2.0 guide for more details.

Cheers,
Umesh, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages