5
votes

I have to retrieve data from the Adwords using Adword's API.

I succeed to retrieve the accounts, the campaigns, the adgroups, the ads, and keywords with the all the necessary attributes etc.

I have a problem with retrieving the site-links.

I try to do that for a campaign which is an active campaign with 100 sitelinks (6 of them are selected).

Following this documentation I use CampaignAdExtensionService and select CampaignAdExtensionService field. Here is my code in ruby (let's say the campaign_id is 12345678):

      campaign_srv = @api.service(:CampaignAdExtensionService, get_api_version())
      campaign_id = 12345678 # for example


      selector = {
          :fields => ['CampaignId', 'DestinationUrl', 'DisplayText'],
          :predicates => {:field => "CampaignId", :operator => "IN", :values => Array(campaign_id)},
          :paging => {:start_index => 0, :number_results => 5000}
      }

      page = campaign_srv.get(selector)

Running this code I get a hash object that doesn't contain any sitelink:

page.to_json = "{"total_num_entries":1,"page_type":"CampaignAdExtensionPage","entries":[{"campaign_id":12345678,"ad_extension":{"id":76543210,"ad_extension_type":"LocationSyncExtension","email":"mail*@domain*.com","icon_media_id":1000,"should_sync_url":false,"xsi_type":"LocationSyncExtension"},"stats":{"network":"ALL","stats_type":"CampaignAdExtensionStats"}}]}"

What is the way to retrieve all the sitelinks of the campaign?

2
You can download adwords report "PLACEHOLDER_FEED_ITEM_REPORT" to get all sitelinksVijaysinh Parmar

2 Answers

0
votes

Upgraded Site Links and Call Extensions are only accessible through the Feed service now. You can fetch location extensions through the CampaignAdExtensionService, but the SiteLinks and CallExtensions have been migrated to the feeds.

0
votes

Here's how to do it in PHP

  public function actionListFeedItems() {
    $feedItems = getFeedItems();
    foreach ($feedItems as $item) {
      echo "$item->feedItemId, $item->feedId, $item->status, ".$item->attributeValues[0]->stringValue."\n";
      // print_r($item->attributeValues);
    }
  } 

  function getFeedItems() {
    $user = $this->getUser();
    $feedItemService = $user->GetService('FeedItemService', ADWORDS_VERSION);
    $awql = 'SELECT FeedItemId, FeedId, Status, AttributeValues'; 
    $page = $feedItemService->query($awql);
    return $page->entries;
  }    

Here is an example from the docs in C# https://developers.google.com/adwords/api/docs/guides/extension-settings#migration_steps