mkk
mkk

Reputation: 7693

google adwords api: how to get adgroupId in Keyword/Ad?

Based on code examples on google website I am able to fetch keywords and ads. The example prints something like this:

 printf("Text ad with headline '%s' and id '%s' was found.\n", $googleAd->ad->headline, $googleAd->ad->id);

based on such field list which was fetched:

 $selector->fields = array('Headline', 'Id')

Is it possible to get adGroupId as well ? I have been looking at documentation for TextAd, however I cannot see adGroupId in field list. I am afraid it is not possible, because adgroup has field called campaignId. Any help?

Upvotes: 1

Views: 2178

Answers (1)

Anash P. Oommen
Anash P. Oommen

Reputation: 607

Yes, it is possible to get adgroup id. It is part of AdGroupAd type, and can be retrieved using "AdGroupId" as selector name. Then you would retrieve the field as $googleAd->adGroupId. More details here:

http://code.google.com/apis/adwords/docs/reference/latest/AdGroupAdService.AdGroupAd.html

In the future, I recommend that you ask the questions on the official AdWords API forum at http://code.google.com/apis/adwords/community/. The forum is pretty active, and AdWords API team members regularly answer developer questions on the forum.

Upvotes: 2

Related Questions