What's the easiest way to view a TextAd With a known Label ID

24 views
Skip to first unread message

Alan Coleman

unread,
Nov 24, 2016, 9:09:44 AM11/24/16
to AdWords API Forum
Hello everyone,

I have a Label ID that I know is attached to x amount of Standard Text Ads in a campaign, I don't know what the TextAd or AdGroups IDs are.

I'd like to see 1 example of a TextAd from a campaign that has the known Label ID attached.

Using the AdGroupAdService I can't simply look for an example of a TextAd with a  Label ID attached because the adGroupId field is required when getting a textAd.

So, do I have to use the following predicates with the AdGroupAdService to return all of the TextAds in a campaign with my known Label ID and sort though the results myself?

 // Create predicates.
$selector->predicates[] = new Predicate('AdGroupId', 'IN', array($adgroupidarr));
$selector->predicates[] = new Predicate('labelId', 'CONTAINS_ANY', array($labelId));
$selector->predicates[] = new Predicate('AdType', 'IN', array('TEXT_AD'));

Since I don't know in which AdGroups my labelled TextAd exists, this would mean searching for, and returning all correctly labelled TextAds in every AdGroup in a campaign.

Am I correct in my approach? Or is there an easier way of finding an example of a TextAd with a known Label ID?

Many thanks



Peter Oliquino

unread,
Nov 25, 2016, 12:32:39 AM11/25/16
to AdWords API Forum
Hi Alan,

My apologies for the delay. Since the AdGroupIds are required, you could try and use first the GetAdGroups PHP example in the client library and use its results in turn as predicates along with the labels using the AdGroupAdService to get the TextAds you need. Let me know if this works for you.

Best regards,
Peter
AdWords API Team

Alan Coleman

unread,
Nov 25, 2016, 4:22:39 AM11/25/16
to AdWords API Forum
Thanks Peter, That was the answer I was looking for and the way that I intended to work, I just thought there might me a more direct method.

Thanks again.
Reply all
Reply to author
Forward
0 new messages