Get all sitelinks in a campaign using the Adwords API

I need to get data from Adwords using the Adword API.

I managed to get accounts, campaigns, ad groups, ads and keywords with all the necessary attributes, etc.

I have a problem finding links to a site.

I am trying to do this for a campaign that is an active campaign with 100 sitelinks (6 of them selected).

Following this documentation, I use CampaignAdExtensionService and select the CampaignAdExtensionService field. Here is my ruby ​​code (say campaign_id 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 does not contain a link:

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

?

+4
2

"". CampaignAdExtensionService, SiteLinks CallExtensions .

0

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;
  }    

# https://developers.google.com/adwords/api/docs/guides/extension-settings#migration_steps

0

All Articles