Hi Visar,
You need to use the CampaignFeedService to retrieve the MatchingFunction
and then parse it to identify the FeedItems that are associated with a
campaign. The C# code to do this looks :
private CampaignFeed[] GetCampaignFeeds(AdWordsUser user, Feed feed) {
CampaignFeedService campaignFeedService = (CampaignFeedService) user.
GetService(
AdWordsService.v201409.CampaignFeedService);
CampaignFeedPage page = campaignFeedService.query(string.Format(
"SELECT CampaignId, MatchingFunction where " +
"Status='ENABLED'and FeedId = '{0}' and PlaceholderTypes=1", feed.id
));
return page.entries;
}
private List<long> GetFeedItemsForCampaign(CampaignFeed campaignFeed) {
List<long> feedItems = new List<long>();
if (campaignFeed.matchingFunction.lhsOperand.Length == 1 &&
campaignFeed.matchingFunction.lhsOperand[0] is RequestContextOperand
&&
(campaignFeed.matchingFunction.lhsOperand[0] as
RequestContextOperand).contextType ==
RequestContextOperandContextType.FEED_ITEM_ID &&
campaignFeed.matchingFunction.@operator == FunctionOperator.IN) {
foreach (ConstantOperand argument in campaignFeed.matchingFunction.
rhsOperand) {
feedItems.Add(argument.longValue);
}
}
return feedItems;
}
GetFeedItemsForCampaign only handles the simplest of the cases (FEEDITEM_ID
IN [id1, id2, id3]). In theory, the matchingfunction can be an arbitrary
expression tree, but if you stick to what the UI can do, then it is
restricted to (FEEDITEM_ID IN [id1, id2, id3]) and DEVICE_PLATFORM =
'Mobile'
Cheers,
Anash P. Oommen,
AdWords API Advisor.
On Wednesday, November 26, 2014 6:23:50 AM UTC-5, Visar wrote:
>
> Hi,
>
> I'm having a little trouble using the API to retrieve structural data on
> sitelinks within an account. What I'm looking to do is to construct a list
> of which sitelinks belong to which campaigns (this is unavailable in the
> reports due to the lack of Zero Impressions support).
>
> Ideally data which could be placed into a table of the form:
>
> CampaignID SitelinkID
> 0000000001 1123412
> 0000000001 1232349
> 0000000002 2342342
> etc..
>
> Given that I have an exhaustive list of all the campaign IDs and sitelink
> IDs (as placeholder feed item IDs), could someone please illustrate how
> this could be done, i.e which services to use and how to actually use them.
> Please be as detailed as possible. I'm currently using PHP but can work
> with any language.
>
> Cheers
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/25f7707e-3b8d-41f5-99aa-b33f4520fa3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.