Hi Visar,
When you removed all sitelinks from CampaignA, did you do so using the UI?
I ask because it may be that the UI may be simply setting the
CampaignFeed.status
<https://developers.google.com/adwords/api/docs/reference/v201409/CampaignFeedService.CampaignFeed#status>
to
*REMOVED* in that case. If so, you can add a predicate in your
CampaignFeedService.get
<https://developers.google.com/adwords/api/docs/reference/v201409/CampaignFeedService#get>
request
on *STATUS = ENABLED* to exclude such *CampaignFeeds*.
Cheers,
Josh, AdWords API Team
On Wednesday, February 11, 2015 at 6:41:20 AM UTC-5, Visar wrote:
>
> Hi again Anash,
>
> I've been trying to implement the code you've illustrated but I'm having a
> few problems.
>
> Problem 1) When you use: campaignFeed.matchingFunction.@operator ==
> FunctionOperator.IN this only picks out those campaigns with more than
> one sitelink ad extension. Those with only one sitelink ad extension have
> an "EQUALS" FunctionOperator rather than an "IN". Is it safe to remove this
> condition, in order to pick up those campaigns matched with one sitelink ad
> extension only?
>
> Problem 2) There is a bigger problem. The matching function does indeed
> return all active site link ad extensions associated with campaigns.
> However, if one removes the all the site links from a campaign (so that the
> campaign is left with no site links), the previously associated site link
> group is still returned by the matching function. I.e there seems to be a
> residue when removing the site links from the campaign wholesale. This
> maybe be illustrated better as follows:
>
> If we start with an account with the following state
> CampaignA => [SitelinkA, SitelinkB]
>
> The matching function returns:
> CampaignA => [SitelinkA, SitelinkB]
>
> If we remove the site links so that there are no associated site links for
> the campaign
> CampaignA => []
>
> The residue of the old grouping of site links will still show up in the
> matching function as follows
> CampaignA => [SitelinkA, SitelinkB]
>
> If, however, one removes just a single site link from the original state
> of affairs, so that in the account it looks like
> CampaignA => [SitelinkA]
>
> The matching function will correctly return
> CampaignA => [SitelinkA]
>
> If we were to now further remove SitelinkA the matching function will
> incorrectly report that SitelinkA is associated with CampaignA. Therefore
> when completely removing site links, there is a residue in the
> corresponding matching function.
>
> Is this a bug?
>
> Is there any way to produce a list of all current and active
> sitelink-campaign associations?
>
> Visar
>
> On Wednesday, November 26, 2014 at 11:53:00 AM UTC, Anash P. Oommen
> (AdWords API Team) wrote:
>>
>> 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/8f9f0a89-fb69-434f-b27e-a0cf3fd628ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.