Retrieve and modify upgraded sitelinks with adwords api

1,152 views
Skip to first unread message

gai-t...@etracker.de

unread,
Jul 4, 2013, 10:54:56 AM7/4/13
to adwor...@googlegroups.com
Hello,

we use Adwords API 201302 and we are wondering how to retrieve and modify upgraded sitelinks with the new FeedServices.

If we have a campaignId, how can we get all the Sitelinks for this campaignId including some more information like e.g. destinationUrl, displayText, campaignName, extensionId and sitelinksIndex.
Shall we use the CampaignFeedService for this? (I read something about AdGroupFeedService too, but I believe sitelinks are retrieved with CampaignFeedService?)

And how can we then modify the sitelink with the API? Using CampaignFeedService.mutate? Or do we need to remove the old sitelink and to add the new one? (Before, we used CampaignAdExtensionService...)

Is there any example of it? We only found examples for adding new sitelinks. Do we need to make any more calls (with other Services) to achieve what we want to do? Like creating first a FeedService and a FeedItemService - some of the examples used them before adding new sitelinks, but we don't know if we need it for already existing sitelinks which we just want to modify...

An answer would be great, thank you!

A. Bregas

gai-t...@etracker.de

unread,
Jul 4, 2013, 11:47:40 AM7/4/13
to adwor...@googlegroups.com
Edit: I found this posting https://groups.google.com/forum/#!topic/adwords-api/RS4XA7A6ixw - Im not sure if we mean the same thing, but as far as I understand they are only talking of FeedItemService... maybe this is the service we need? I am not sure ...

Oliver

unread,
Jul 5, 2013, 2:53:43 AM7/5/13
to adwor...@googlegroups.com
There is very little documentation or code examples on how to do this.  I really hope the API team will soon add this info to the docs as we've requested it few times in the past.  We have lots of examples of how to add sitelinks but nothing at all on how to read or modify them.  And the way they work doesn't make it easy to guess either.  Adding and modifying sitelinks is part of the RMF so I'm sure there is huge demand for such info.

Oliver

Danial Klimkin

unread,
Jul 9, 2013, 5:08:40 PM7/9/13
to adwor...@googlegroups.com
Hello,


Please see our Feeds guide:


we also have an example for each of our client libraries, see:



-Danial, AdWords API Team.

Anash P. Oommen (AdWords API Team)

unread,
Jul 10, 2013, 1:54:25 AM7/10/13
to adwor...@googlegroups.com
Hi Oliver,

You bring up an interesting point - You somehow didn't locate the guide on your own. I wonder, how could we have made this guide easier to locate? 

Cheers,
Anash

Oliver

unread,
Jul 10, 2013, 4:13:57 AM7/10/13
to adwor...@googlegroups.com
Hi Anash,

The feeds guide Danial pointed out was easy to find but it covers only creating new sitelinks.  The enquirer was asking about retrieving and modifying existing sitelinks.  The logic/model of feeds, at least for me, is a bit convoluted and not easy to reverse engineer the current code examples to try and figure out how other use cases should work.  It will really help if you can add more code examples to the feeds guide to cover at least retrieving sitelinks.

Many thanks

Oliver

Anash P. Oommen (AdWords API Team)

unread,
Jul 11, 2013, 5:31:56 AM7/11/13
to adwor...@googlegroups.com
Hi Oliver,

Thanks for the feedback, I'll ask the team to work on it.

Cheers,
Anash

gai-t...@etracker.de

unread,
Jul 15, 2013, 2:48:57 AM7/15/13
to adwor...@googlegroups.com
That is exactly what I meant. The guide was really easy to find, but it did not help me to understand how to *retrieve and modify* sitelinks. Some small advice, maybe just in words - which Services do we need to use in which order - that would be so great and help so much, please!

I am also confused by all the services - I dont really understand the differences between for example AdGroupFeedService an CampaignFeedService - can both be used for sitelinks?

Thank you.

Anash P. Oommen (AdWords API Team)

unread,
Jul 15, 2013, 3:05:46 AM7/15/13
to adwor...@googlegroups.com
Hi,

Sitelinks can be created at AdGroup and Campaign levels - hence two services to deal with each case. Thanks for the feedback, I'll ask our techwriter to look into it.

Cheers,
Anash

gai-t...@etracker.de

unread,
Jul 15, 2013, 4:21:34 AM7/15/13
to adwor...@googlegroups.com
Thanks for your answer. In the web interface, how can I find out if sitelinks are created at AdGroup or Campaign level? 

Oliver

unread,
Jul 15, 2013, 12:47:33 PM7/15/13
to adwor...@googlegroups.com
See the attached screenshot. The upper grid is for campaigns while the lower one is for adgroups.



Oliver

james

unread,
Jul 15, 2013, 10:08:33 PM7/15/13
to adwor...@googlegroups.com
Have just started on this too. Here is my understanding:
 
Sitelinks are retrieved with the FeedItemService. That gives the sitelinks with all their data.
But it also retrieves other types of FeedItems (phone numbers, offers, etc).
You need to use the FeedMappingService to generically tell if a feed item is a sitelink (by checking for PlaceHolderId=1). There are assumption based shortcuts you could use such as looking at the FeedService::feedName, but I don't like risk - and not sure about other language accounts.
 
Feed Items (including sitelinks) exist "above" campaigns.  
Then the campaignFeedService (or AdgroupFeedService) is used to link these sitelink feed items to multiple campaigns and/or adgroups.
 
So the approach I am looking to implement is:
1 - FeedMappingService::get
    Store the results in a hash keyed on feedMappingId
2 - FeedItemService::get
    For each one look up validationDetails.feedMappingId in the hash. If the hashed placeholderId == 1 its a sitelink
    Save the sitelinks to our system
3 - CampaignFeedService::get / AdgroupFeedService::get
    Find the matching feedItemIds (think this will have to be the matching function)
    Store the links between sitelinks and campaigns/adgroups in our system
4 - FeedItemService::put
    If you want to modify the sitelinks themselves (change URLs etc)
5 - CampaignFeedService::put / AdgroupFeedService::put
    If you want to change which Campaigns/Adgroups the sitelinks are attached to
 
Now Google have made this all MUCH more complicated than it was. So I am assuming there has to be some kind of payoff for it coming down the track. I guess the advantage for them is they don't need to keep adding new services as they come up with new AdExtensions. But this new Feed model is VERY generic and thus quite daunting when you first start. As I said I've just started on this and am learning each day myself.
 
Good luck

gai-t...@etracker.de

unread,
Jul 16, 2013, 3:41:51 AM7/16/13
to adwor...@googlegroups.com
Cool! I did not see that yet, because I only have seen sitelinks on campaign level so far - thank you!! :-)

Anash P. Oommen (AdWords API Team)

unread,
Jul 16, 2013, 3:46:43 AM7/16/13
to adwor...@googlegroups.com
Thanks James for clarifying, it is indeed true that if you don't check for PlaceHolderId, then you will get every type of ad extension for the campaign. (Yeah, I know, no code examples...)

Cheers,
Anash

gai-t...@etracker.de

unread,
Jul 16, 2013, 3:49:43 AM7/16/13
to adwor...@googlegroups.com
Hello james!

That sounds good!! I had a very different understanding of it - I thought, the CampaignFeedService was used for retrieving and modifying sitelinks on Campaign level and the AdGroupFeedService for retrieving and modifying sitelinks on adgroup level and I was starting to implement it. 

But I will now start to implement it how you tell it - it would be so great if this would work!! :-)
Lets keep each other up to date about the progress while implementing it, maybe we can inform each other if it really works!

Greetings and good luck too

gai-t...@etracker.de

unread,
Jul 16, 2013, 5:54:33 AM7/16/13
to adwor...@googlegroups.com

Hello, I tried to implement it like you said. Requesting AttributeValues is only for testing, we just want to test that we can request Sitelinks in general. The campaign we use for testing has for sure upgraded sitelinks. Unfortunately, every time we start the request, the result is null (feedItems.getEntries). We tried with FeedMappingService too.

We assume that maybe the FeedItemId is not the CampaignId, which we use for requesting. But which field represents the campaign id? Or isn't it possible to request the sitelinks by campaignId?

It would be very nice if you could give us a hint. We also tried to use an "empty selector", but we always got error messages that a selector was required or should contain fields, etc...
Here is the code:

FeedItemServiceInterface feedItemService = adSession.getService(AdWordsService.V201302.FEED_ITEM_SERVICE);
Selector selector = new Selector();
selector.setFields(new String[]
{
"AttributeValues"
//"AttributeValues", "DevicePreference", "EndTime", "FeedId", "FeedItemId", "Scheduling", "StartTime", "Status", "ValidationDetails"
});
final Predicate predicate = new Predicate("FeedItemId",
PredicateOperator.IN,
new String[]
{
campaignId.toString()
});
selector.setPredicates(new Predicate[]
{
predicate
});
FeedItemPage feedItems = feedItemService.get(selector);
Thank you very much!!!

gai-t...@etracker.de

unread,
Jul 16, 2013, 5:58:04 AM7/16/13
to adwor...@googlegroups.com
We tried without predicate too, but the result is still null - please help :-(

gai-t...@etracker.de

unread,
Jul 16, 2013, 8:25:33 AM7/16/13
to adwor...@googlegroups.com
We had some success. First we use FeedMappingService (without predicates) and if placeholdertype==1 we use FeedItemService and then we get every sitelinks with their attributes (like url and name) for every campaign.
With CampaignFeedService we are able to retrieve all campaigns and their matching functions. There we select the campaign we want to have.

Now we'd like to know if we have FeedItems which belong to this campaign. We guess that this can be achieved by using the matching function, like james said - only that the usage is not very easy to understand.

But so far everything james metioned was correct, so thank you very much! We will now try to use the matchingFunction. We saw some examples, but they did not help much :-) If anybody has already tried this out, a snippet would be great :-)


Am Donnerstag, 4. Juli 2013 16:54:56 UTC+2 schrieb gai-t...@etracker.de:

gai-t...@etracker.de

unread,
Jul 16, 2013, 10:15:08 AM7/16/13
to adwor...@googlegroups.com
FYI:

The campaign's matching function does already contain the feedItemIds (rhsOperator), so you can easily retrieve them. 
 
:-)

Am Donnerstag, 4. Juli 2013 16:54:56 UTC+2 schrieb gai-t...@etracker.de:

gai-t...@etracker.de

unread,
Jul 16, 2013, 12:26:11 PM7/16/13
to adwor...@googlegroups.com
Could it be that AdGroupFeedService.get(selector) is a beta feature? We get a beta error while trying to use it... when will it be accessible for normal usage?


Am Donnerstag, 4. Juli 2013 16:54:56 UTC+2 schrieb gai-t...@etracker.de:

james

unread,
Aug 13, 2013, 3:21:45 AM8/13/13
to adwor...@googlegroups.com
Yep, turns out it is a beta feature, and thus will only work for select developers. As described here
 
First I've head of the limited access beta concept. It does say "This is a beta feature" on the API service page, but no warning that that means it will not work. Live and learn.

Alexandre Miyagi

unread,
Aug 21, 2013, 5:42:40 PM8/21/13
to adwor...@googlegroups.com
Ok, I retrieve the adGroupFeeds but the matching function is null.
So I can't retrieve the feeditemIds. am I missing something?


Francesco Della Vedova

unread,
Oct 7, 2013, 3:46:11 AM10/7/13
to adwor...@googlegroups.com
Hi all...I'm trying to retrieve the site links as well, with the python library. I tried following the instructions in this thread but all I get is:

adspygoogle.adwords.AdWordsErrors.AdWordsApiError: Fault occurred while processing.

I tried providing FeedId when GETting from feeditemservice, I tried with FeedItemId, and with no predicates at all. Error is Always the same, that doesn't really say much to me...
any help on this?

Brian Moeskau

unread,
Jul 28, 2014, 1:24:50 AM7/28/14
to adwor...@googlegroups.com
Looking into how to retrieve sitelinks for campaigns -- is this answer still (after a year) the accepted way of doing this? Because if so, wow.  This API needs some serious work.

Anash P. Oommen (AdWords API Team)

unread,
Jul 30, 2014, 8:26:33 AM7/30/14
to adwor...@googlegroups.com
Hi Brian,

Yep, unfortunately, we haven't changed the FeedServices after it was launched, so the original discussion still holds valid

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Kevin Moritz

unread,
Oct 24, 2014, 1:31:12 PM10/24/14
to adwor...@googlegroups.com
Has the new v201409 AdWords API changed anything regarding campaign sitelink retrieval?

Kevin

Milo Hou

unread,
Aug 19, 2015, 7:19:28 PM8/19/15
to AdWords API Forum
Have there been any updates to sitelink removal or examples? Once a sitelink is removed how should i re-add it to a campaign?

Anash P. Oommen (AdWords API Team)

unread,
Aug 20, 2015, 3:55:59 PM8/20/15
to AdWords API Forum
Hi Milo,

You'd probably want to take a look at ExtensionSetting services; they are a simplified set of services on top of FeedServices that make working with extensions simple. https://developers.google.com/adwords/api/docs/guides/extension-settings has usage and examples.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Reply all
Reply to author
Forward
0 new messages