動的検索広告

動的検索広告(DSA)を使うと、あらゆるパターンを網羅するようなキーワードや広告コピーを作成しなくても、ウェブサイト全体(または一部)をターゲットに設定できます。さらに、ユーザーが関連性のある検索を行うと、検索語句に基づいた見出しや、最も関連性の高いランディング ページに基づいたテキストが含まれる広告が動的に生成されます。このような広告は、通常の広告と同じようにオークションにかけられ、掲載候補になります。そのため、既存のキーワード キャンペーンに変更を加えることなく、商品やサービスをより多くのユーザーにアピールして成果を高めることができます。

また動的検索広告は、ウェブサイトやドメイン全体を広範囲に対象にできるほか、既存のキャンペーンやキーワードのバックアップとして、またあらゆる状況に対応する優れた広告として活用できます。キーワード、広告グループ、広告コピーを通常どおり設定した後に動的検索広告を追加すると、既存のキャンペーン設定に一致しない検索語句をできるだけ多くカバーできるようになります。

ここでは、AdWords API を使って動的検索広告を作成して使用する手順について説明します。

動的検索広告を作成する

API で動的検索広告を設定する手順は次のとおりです。

  1. キャンペーンを設定して、キャンペーンのドメインを指定します。
  2. 動的検索広告に関連する機能を使用する広告グループを作成します。
  3. 動的検索広告を 1 つ以上作成します。
  4. キャンペーンで動的検索広告を表示する条件を 1 つ以上指定します。

キャンペーンを設定する

キャンペーンで動的検索広告を使用するには、まず advertisingChannelTypeSEARCH に設定したキャンペーンを作成します。また、Campaign オブジェクトの settings プロパティで DynamicSearchAdsSetting オブジェクトを設定して、動的検索広告が動作するドメインを指定します。

次の例では、動的検索広告キャンペーンを作成します。

C#

private static Campaign CreateCampaign(AdWordsUser user, Budget budget) {
  using (CampaignService campaignService =
      (CampaignService) user.GetService(AdWordsService.v201802.CampaignService)) {
    // Create a Dynamic Search Ads campaign.
    Campaign campaign = new Campaign();
    campaign.name = "Interplanetary Cruise #" + ExampleUtilities.GetRandomString();
    campaign.advertisingChannelType = AdvertisingChannelType.SEARCH;

    // Recommendation: Set the campaign to PAUSED when creating it to prevent
    // the ads from immediately serving. Set to ENABLED once you've added
    // targeting and the ads are ready to serve.
    campaign.status = CampaignStatus.PAUSED;

    BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
    biddingConfig.biddingStrategyType = BiddingStrategyType.MANUAL_CPC;
    campaign.biddingStrategyConfiguration = biddingConfig;

    campaign.budget = new Budget();
    campaign.budget.budgetId = budget.budgetId;

    // Required: Set the campaign's Dynamic Search Ads settings.
    DynamicSearchAdsSetting dynamicSearchAdsSetting = new DynamicSearchAdsSetting();
    // Required: Set the domain name and language.
    dynamicSearchAdsSetting.domainName = "example.com";
    dynamicSearchAdsSetting.languageCode = "en";

    // Set the campaign settings.
    campaign.settings = new Setting[] { dynamicSearchAdsSetting };

    // Optional: Set the start date.
    campaign.startDate = DateTime.Now.AddDays(1).ToString("yyyyMMdd");

    // Optional: Set the end date.
    campaign.endDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd");

    // Create the operation.
    CampaignOperation operation = new CampaignOperation();
    operation.@operator = Operator.ADD;
    operation.operand = campaign;

    try {
      // Add the campaign.
      CampaignReturnValue retVal = campaignService.mutate(
          new CampaignOperation[] { operation });

      // Display the results.
      Campaign newCampaign = retVal.value[0];
      Console.WriteLine("Campaign with id = '{0}' and name = '{1}' was added.",
        newCampaign.id, newCampaign.name);
      return newCampaign;
    } catch (Exception e) {
      throw new System.ApplicationException("Failed to add campaigns.", e);
    }
  }
}

Java

private static Campaign createCampaign(
    AdWordsServicesInterface adWordsServices, AdWordsSession session, Budget budget)
    throws RemoteException, ApiException {
  // Get the CampaignService.
  CampaignServiceInterface campaignService =
      adWordsServices.get(session, CampaignServiceInterface.class);

  // Create campaign.
  Campaign campaign = new Campaign();
  campaign.setName("Interplanetary Cruise #" + System.currentTimeMillis());
  campaign.setAdvertisingChannelType(AdvertisingChannelType.SEARCH);

  // Recommendation: Set the campaign to PAUSED when creating it to prevent
  // the ads from immediately serving. Set to ENABLED once you've added
  // targeting and the ads are ready to serve.
  campaign.setStatus(CampaignStatus.PAUSED);

  BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
  biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);
  campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

  // Only the budgetId should be sent, all other fields will be ignored by CampaignService.
  Budget campaignBudget = new Budget();
  campaignBudget.setBudgetId(budget.getBudgetId());
  campaign.setBudget(campaignBudget);

  // Required: Set the campaign's Dynamic Search Ads settings.
  DynamicSearchAdsSetting dynamicSearchAdsSetting = new DynamicSearchAdsSetting();
  // Required: Set the domain name and language.
  dynamicSearchAdsSetting.setDomainName("example.com");
  dynamicSearchAdsSetting.setLanguageCode("en");

  // Set the campaign settings.
  campaign.setSettings(new Setting[] {dynamicSearchAdsSetting});

  // Optional: Set the start date.
  campaign.setStartDate(new DateTime().plusDays(1).toString("yyyyMMdd"));
  // Optional: Set the end date.
  campaign.setEndDate(new DateTime().plusYears(1).toString("yyyyMMdd"));

  // Create the operation.
  CampaignOperation operation = new CampaignOperation();
  operation.setOperand(campaign);
  operation.setOperator(Operator.ADD);

  // Add the campaign.
  Campaign newCampaign = campaignService.mutate(new CampaignOperation[] {operation}).getValue(0);

  // Display the results.
  System.out.printf(
      "Campaign with name '%s' and ID %d was added.%n",
      newCampaign.getName(), newCampaign.getId());

  return newCampaign;
}

Python

campaign_service = client.GetService('CampaignService')

operations = [{
    'operator': 'ADD',
    'operand': {
        'name': 'Interplanetary Cruise #%d' % uuid.uuid4(),
        # Recommendation: Set the campaign to PAUSED when creating it to
        # prevent the ads from immediately serving. Set to ENABLED once you've
        # added targeting and the ads are ready to serve.
        'status': 'PAUSED',
        'advertisingChannelType': 'SEARCH',
        'biddingStrategyConfiguration': {
            'biddingStrategyType': 'MANUAL_CPC',
        },
        'budget': budget,
        # Required: Set the campaign's Dynamic Search Ad settings.
        'settings': [{
            'xsi_type': 'DynamicSearchAdsSetting',
            # Required: Set the domain name and language.
            'domainName': 'example.com',
            'languageCode': 'en'
        }],
        # Optional: Set the start date.
        'startDate': (datetime.datetime.now() +
                      datetime.timedelta(1)).strftime('%Y%m%d'),
        # Optional: Set the end date.
        'endDate': (datetime.datetime.now() +
                    datetime.timedelta(365)).strftime('%Y%m%d'),
    }
}]

campaign = campaign_service.mutate(operations)['value'][0]
campaign_id = campaign['id']

print 'Campaign with ID "%d" and name "%s" was added.' % (
    campaign_id, campaign['name'])

PHP

private static function createCampaign(
      AdWordsServices $adWordsServices,
      AdWordsSession $session,
      Budget $budget
  ) {
      $campaignService = $adWordsServices->get($session, CampaignService::class);

      // Create campaign with some properties set.
      $campaign = new Campaign();
      $campaign->setName('Interplanetary Cruise #' . uniqid());
      $campaign->setAdvertisingChannelType(AdvertisingChannelType::SEARCH);

      // Recommendation: Set the campaign to PAUSED when creating it to prevent
      // the ads from immediately serving. Set to ENABLED once you've added
      // targeting and the ads are ready to serve.
      $campaign->setStatus(CampaignStatus::PAUSED);

      $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
      $biddingStrategyConfiguration->setBiddingStrategyType(
          BiddingStrategyType::MANUAL_CPC
      );
      $campaign->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

      // Only the budgetId should be sent, all other fields will be ignored by
      // CampaignService.
      $campaignBudget = new Budget();
      $campaignBudget->setBudgetId($budget->getBudgetId());
      $campaign->setBudget($campaignBudget);

      // Required: Set the campaign's Dynamic Search Ads settings.
      $dynamicSearchAdsSetting = new DynamicSearchAdsSetting();
      // Required: Set the domain name and language.
      $dynamicSearchAdsSetting->setDomainName('example.com');
      $dynamicSearchAdsSetting->setLanguageCode('en');

      // Set the campaign settings.
      $campaign->setSettings([$dynamicSearchAdsSetting]);

      // Optional: Set the start date.
      $campaign->setStartDate(date('Ymd', strtotime('+1 day')));
      // Optional: Set the end date.
      $campaign->setEndDate(date('Ymd', strtotime('+1 year')));

      // Create a campaign operation.
      $operation = new CampaignOperation();
      $operation->setOperand($campaign);
      $operation->setOperator(Operator::ADD);

      // Create the campaign on the server and print out some information.
      $result = $campaignService->mutate([$operation]);
      $campaign = $result->getValue()[0];
      printf(
          "Campaign with name '%s' and ID %d was added.\n",
          $campaign->getName(),
          $campaign->getId()
      );

      return $campaign;
  }

Perl

# Creates the campaign.
sub _create_campaign {
  my ($client, $budget) = @_;

  # Required: Set the campaign's Dynamic Search Ads settings.
  my $dynamic_search_ads_setting =
    Google::Ads::AdWords::v201802::DynamicSearchAdsSetting->new({
      # Required: Set the domain name and language.
      domainName   => "example.com",
      languageCode => "en"
    });

  # Calculating a start date of today and an end date 1 year from now.
  my (undef, undef, undef, $mday, $mon, $year) = localtime(time + 60 * 60 * 24);
  my $start_date = sprintf("%d%02d%02d", ($year + 1900), ($mon + 1), $mday);
  (undef, undef, undef, $mday, $mon, $year) =
    localtime(time + 60 * 60 * 24 * 365);
  my $end_date = sprintf("%d%02d%02d", ($year + 1900), ($mon + 1), $mday);

  my $campaign = Google::Ads::AdWords::v201802::Campaign->new({
      name => sprintf("Interplanetary Cruise #%s", uniqid()),
      biddingStrategyConfiguration =>
        Google::Ads::AdWords::v201802::BiddingStrategyConfiguration->new({
          biddingStrategyType => "MANUAL_CPC"
        }
        ),
      # Only the budgetId should be sent, all other fields will be ignored by
      # CampaignService.
      budget => Google::Ads::AdWords::v201802::Budget->new(
        {budgetId => $budget->get_budgetId()}
      ),
      advertisingChannelType => "SEARCH",
      settings               => [$dynamic_search_ads_setting],
      # Additional properties (non-required).
      startDate => $start_date,
      endDate   => $end_date,
      # Recommendation: Set the campaign to PAUSED when creating it to stop
      # the ads from immediately serving. Set to ENABLED once you've added
      # targeting and the ads are ready to serve.
      status => "PAUSED"
    });

  # Create operation.
  my $campaign_operation =
    Google::Ads::AdWords::v201802::CampaignOperation->new({
      operator => "ADD",
      operand  => $campaign
    });

  # Add campaigns.
  my $result =
    $client->CampaignService()->mutate({operations => [$campaign_operation]});

  # Display campaigns.
  my $new_campaign = $result->get_value()->[0];
  printf "Campaign with name '%s' and ID %d was added.\n",
    $new_campaign->get_name(),
    $new_campaign->get_id();
  return $new_campaign;
}

Ruby

def create_campaign(adwords, budget)
  campaign_srv = adwords.service(:CampaignService, API_VERSION)

  campaign = {
    :name => "Interplanetary Cruise #%d" % (Time.now.to_f * 1000).to_i,
    :advertising_channel_type => 'SEARCH',
    # Recommendation: Set the campaign to PAUSED when creating it to prevent the
    # ads from immediately serving. Set to ENABLED once you've added targeting
    # and the ads are ready to serve.
    :status => 'PAUSED',
    :bidding_strategy_configuration => {
      :bidding_strategy_type => 'MANUAL_CPC'
    },
    # Only the budgetId should be sent; all other fields will be ignored by
    # CampaignService.
    :budget => {
      :budget_id => budget[:budget_id]
    },
    :settings => [
      :xsi_type => 'DynamicSearchAdsSetting',
      :domain_name => 'example.com',
      :language_code => 'en'
    ],
    # Optional: Set the start and end dates.
    :start_date => DateTime.parse((Date.today + 1).to_s).strftime('%Y%m%d'),
    :end_date => DateTime.parse(Date.today.next_year.to_s).strftime('%Y%m%d')
  }

  operation = {
    :operand => campaign,
    :operator => 'ADD'
  }

  new_campaign = campaign_srv.mutate([operation])[:value].first
  puts "Campaign with name '%s' and ID %d was added." %
      [new_campaign[:name], new_campaign[:id]]

  return new_campaign
end

広告グループを作成する

動的検索広告の機能を使用するには、adGroupTypeAdGroupType.SEARCH_DYNAMIC_ADS として広告グループを作成する必要があります。この広告グループタイプでは、次の制限がありますのでご注意ください。

  • この広告グループのタイプは検索キャンペーンにのみ追加できます。
  • 広告グループを追加するには、キャンペーン単位で有効な DynamicSearchAdsSetting が必要です。これが設定されていないと、AdGroupServiceError.CANNOT_ADD_ADGROUP_OF_TYPE_DSA_TO_CAMPAIGN_WITHOUT_DSA_SETTING エラーが返されます。
  • この広告グループのタイプでは、キーワード(非除外キーワード)は使用できません。オーディエンス、動的広告ターゲット、除外キーワードは使用できます。
  • すべての広告グループと同様、adGroupType は構成後に変更することはできません。
  • この広告グループでは、動的検索広告に関連する広告フォーマットのみが許可されます。

次のコードサンプルは、SEARCH_DYNAMIC_ADS タイプの広告グループを作成する方法を示しています。

C#

private static AdGroup CreateAdGroup(AdWordsUser user, long campaignId) {
  using (AdGroupService adGroupService =
      (AdGroupService) user.GetService(AdWordsService.v201802.AdGroupService)) {
    // Create the ad group.
    AdGroup adGroup = new AdGroup();

    // Required: Set the ad group's type to Dynamic Search Ads.
    adGroup.adGroupType = AdGroupType.SEARCH_DYNAMIC_ADS;

    adGroup.name = string.Format("Earth to Mars Cruises #{0}",
      ExampleUtilities.GetRandomString());
    adGroup.campaignId = campaignId;
    adGroup.status = AdGroupStatus.PAUSED;

    // Recommended: Set a tracking URL template for your ad group if you want to use URL
    // tracking software.
    adGroup.trackingUrlTemplate = "http://tracker.example.com/traveltracker/{escapedlpurl}";

    // Set the ad group bids.
    BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();

    CpcBid cpcBid = new CpcBid();
    cpcBid.bid = new Money();
    cpcBid.bid.microAmount = 3000000;

    biddingConfig.bids = new Bids[] { cpcBid };

    adGroup.biddingStrategyConfiguration = biddingConfig;

    // Create the operation.
    AdGroupOperation operation = new AdGroupOperation();
    operation.@operator = Operator.ADD;
    operation.operand = adGroup;

    try {
      // Create the ad group.
      AdGroupReturnValue retVal = adGroupService.mutate(new AdGroupOperation[] { operation });

      // Display the results.
      AdGroup newAdGroup = retVal.value[0];
      Console.WriteLine("Ad group with id = '{0}' and name = '{1}' was created.",
        newAdGroup.id, newAdGroup.name);
      return newAdGroup;
    } catch (Exception e) {
      throw new System.ApplicationException("Failed to create ad group.", e);
    }
  }
}

Java

private static AdGroup createAdGroup(
    AdWordsServicesInterface adWordsServices, AdWordsSession session, Campaign campaign)
    throws ApiException, RemoteException {
  // Get the AdGroupService.
  AdGroupServiceInterface adGroupService =
      adWordsServices.get(session, AdGroupServiceInterface.class);

  // Create the ad group.
  AdGroup adGroup = new AdGroup();

  // Required: Set the ad group's type to Dynamic Search Ads.
  adGroup.setAdGroupType(AdGroupType.SEARCH_DYNAMIC_ADS);

  adGroup.setName("Earth to Mars Cruises #" + System.currentTimeMillis());
  adGroup.setCampaignId(campaign.getId());
  adGroup.setStatus(AdGroupStatus.PAUSED);

  // Recommended: Set a tracking URL template for your ad group if you want to use URL
  // tracking software.
  adGroup.setTrackingUrlTemplate("http://tracker.example.com/traveltracker/{escapedlpurl}");

  // Set the ad group bids.
  BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();

  CpcBid cpcBid = new CpcBid();
  cpcBid.setBid(new Money());
  cpcBid.getBid().setMicroAmount(3000000L);

  biddingConfig.setBids(new Bids[] {cpcBid});

  adGroup.setBiddingStrategyConfiguration(biddingConfig);

  // Create the operation.
  AdGroupOperation operation = new AdGroupOperation();
  operation.setOperand(adGroup);
  operation.setOperator(Operator.ADD);

  AdGroup newAdGroup = adGroupService.mutate(new AdGroupOperation[] {operation}).getValue(0);
  System.out.printf(
      "Ad group with name '%s' and ID %d was added.%n", newAdGroup.getName(), newAdGroup.getId());
  return newAdGroup;
}

Python

ad_group_service = client.GetService('AdGroupService')

operations = [{
    'operator': 'ADD',
    'operand': {
        'campaignId': campaign_id,
        'adGroupType': 'SEARCH_DYNAMIC_ADS',
        'name': 'Earth to Mars Cruises #%d' % uuid.uuid4(),
        'status': 'PAUSED',
        'biddingStrategyConfiguration': {
            'bids': [{
                'xsi_type': 'CpcBid',
                'bid': {
                    'microAmount': '3000000'
                },
            }]
        }
    }
}]

ad_group = ad_group_service.mutate(operations)['value'][0]
ad_group_id = ad_group['id']

print 'Ad group with ID "%d" and name "%s" was created.' % (
    ad_group_id, ad_group['name'])

PHP

private static function createAdGroup(
      AdWordsServices $adWordsServices,
      AdWordsSession $session,
      Campaign $campaign
  ) {
      $adGroupService = $adWordsServices->get($session, AdGroupService::class);

      // Create the ad group.
      $adGroup = new AdGroup();

      // Required: Set the ad group's type to Dynamic Search Ads.
      $adGroup->setAdGroupType(AdGroupType::SEARCH_DYNAMIC_ADS);

      $adGroup->setName('Interplanetary Cruise #' . uniqid());
      $adGroup->setCampaignId($campaign->getId());
      $adGroup->setStatus(AdGroupStatus::PAUSED);

      // Recommended: Set a tracking URL template for your ad group if you want to
      // use URL tracking software.
      $adGroup->setTrackingUrlTemplate(
          'http://tracker.example.com/traveltracker/{escapedlpurl}'
      );

      // Set the ad group bids.
      $biddingStrategyConfiguration = new BiddingStrategyConfiguration();

      $cpcBid = new CpcBid();
      $money = new Money();
      $money->setMicroAmount(3000000);
      $cpcBid->setBid($money);
      $biddingStrategyConfiguration->setBids([$cpcBid]);

      $adGroup->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

      // Create an ad group operation.
      $operation = new AdGroupOperation();
      $operation->setOperand($adGroup);
      $operation->setOperator(Operator::ADD);

      // Create the ad group on the server and print out some information.
      $result = $adGroupService->mutate([$operation]);
      $adGroup = $result->getValue()[0];
      printf(
          "Ad group with name '%s' and ID %d was added.\n",
          $adGroup->getName(),
          $adGroup->getId()
      );

      return $adGroup;
  }

Perl

# Creates the ad group.
sub _create_ad_group {
  my ($client, $campaign) = @_;

  my $ad_group = Google::Ads::AdWords::v201802::AdGroup->new({
      name       => sprintf("Earth to Mars Cruises #%s", uniqid()),
      campaignId => $campaign->get_id(),
      # Required: Set the ad group's type to Dynamic Search Ads.
      adGroupType => "SEARCH_DYNAMIC_ADS",
      status      => "PAUSED",
      # Recommended: Set a tracking URL template for your ad group if you want
      # to use URL tracking software.
      trackingUrlTemplate =>
        "http://tracker.example.com/traveltracker/{escapedlpurl}",
      biddingStrategyConfiguration =>
        Google::Ads::AdWords::v201802::BiddingStrategyConfiguration->new({
          bids => [
            Google::Ads::AdWords::v201802::CpcBid->new({
                bid => Google::Ads::AdWords::v201802::Money->new(
                  {microAmount => 3000000}
                ),
              }
            ),
          ]})});

  # Create operation.
  my $ad_group_operation =
    Google::Ads::AdWords::v201802::AdGroupOperation->new({
      operator => "ADD",
      operand  => $ad_group
    });

  my $result =
    $client->AdGroupService()->mutate({operations => [$ad_group_operation]});
  my $new_ad_group = $result->get_value()->[0];
  printf "Ad group with name '%s' and ID %d was added.\n",
    $new_ad_group->get_name(), $new_ad_group->get_id();
  return $new_ad_group;
}

Ruby

def create_ad_group(adwords, campaign)
  ad_group_srv = adwords.service(:AdGroupService, API_VERSION)

  ad_group = {
    # Required: Set the ad group's tpe to Dynamic Search Ads.
    :ad_group_type => 'SEARCH_DYNAMIC_ADS',
    :name => "Earth to Mars Cruises #%d" % (Time.now.to_f * 1000).to_i,
    :campaign_id => campaign[:id],
    :status => 'PAUSED',
    # Recommended: Set a tracking URL template for your ad group if you want to
    # use URL tracking software.
    :tracking_url_template =>
        'http://tracker.example.com/traveltracker/{escapedlpurl}',
    :bidding_strategy_configuration => {
      :bids => [{
        :xsi_type => 'CpcBid',
        :bid => {
          :micro_amount => 3_000_000
        }
      }]
    }
  }

  operation = {
    :operand => ad_group,
    :operator => 'ADD'
  }

  new_ad_group = ad_group_srv.mutate([operation])[:value].first
  puts "Ad group with name '%s' and ID %d was added." %
      [new_ad_group[:name], new_ad_group[:id]]

  return new_ad_group
end

動的検索広告を作成する

次に、ExpandedDynamicSearchAd オブジェクトを作成します。この広告は、キャンペーン単位で DynamicSearchAdsSetting にて指定したドメイン名に固有の情報に従って、配信時に広告見出し、表示 URL、および最終 URL が自動生成されますが、広告の description はご自身で提供していただく必要があります。

C#

private static ExpandedDynamicSearchAd CreateExpandedDSA(AdWordsUser user, long adGroupId) {
  using (AdGroupAdService adGroupAdService =
      (AdGroupAdService) user.GetService(AdWordsService.v201802.AdGroupAdService)) {
    // Create an Expanded Dynamic Search Ad. This ad will have its headline, display URL and
    // final URL auto-generated at serving time according to domain name specific information
    // provided by DynamicSearchAdsSetting at the campaign level.
    ExpandedDynamicSearchAd expandedDSA = new ExpandedDynamicSearchAd();
    // Set the ad description.
    expandedDSA.description = "Buy your tickets now!";

    // Create the ad group ad.
    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.adGroupId = adGroupId;
    adGroupAd.ad = expandedDSA;

    // Optional: Set the status.
    adGroupAd.status = AdGroupAdStatus.PAUSED;

    // Create the operation.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.@operator = Operator.ADD;
    operation.operand = adGroupAd;

    try {
      // Create the ad.
      AdGroupAdReturnValue retval = adGroupAdService.mutate(
          new AdGroupAdOperation[] { operation });

      // Display the results.
      AdGroupAd newAdGroupAd = retval.value[0];
      ExpandedDynamicSearchAd newAd = newAdGroupAd.ad as ExpandedDynamicSearchAd;
      Console.WriteLine("Expanded Dynamic Search Ad with ID '{0}' and description '{1}' " +
          "was added.", newAd.id, newAd.description);
      return newAd;
    } catch (Exception e) {
      throw new System.ApplicationException("Failed to create Expanded Dynamic Search Ad.", e);
    }
  }
}

Java

private static void createExpandedDSA(
    AdWordsServicesInterface adWordsServices, AdWordsSession session, AdGroup adGroup)
    throws ApiException, RemoteException {
  // Get the AdGroupAdService.
  AdGroupAdServiceInterface adGroupAdService =
      adWordsServices.get(session, AdGroupAdServiceInterface.class);

  // Create the expanded Dynamic Search Ad. This ad will have its headline and final URL
  // auto-generated at serving time according to domain name specific information provided
  // by DynamicSearchAdsSetting at the campaign level.
  ExpandedDynamicSearchAd expandedDSA = new ExpandedDynamicSearchAd();
  // Set the ad description.
  expandedDSA.setDescription("Buy your tickets now!");

  // Create the ad group ad.
  AdGroupAd adGroupAd = new AdGroupAd();
  adGroupAd.setAdGroupId(adGroup.getId());
  adGroupAd.setAd(expandedDSA);

  // Optional: Set the status.
  adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

  // Create the operation.
  AdGroupAdOperation operation = new AdGroupAdOperation();
  operation.setOperator(Operator.ADD);
  operation.setOperand(adGroupAd);

  // Create the ad.
  AdGroupAd newAdGroupAd =
      adGroupAdService.mutate(new AdGroupAdOperation[] {operation}).getValue(0);
  ExpandedDynamicSearchAd newExpandedDSA = (ExpandedDynamicSearchAd) newAdGroupAd.getAd();
  System.out.printf(
      "Expanded Dynamic Search Ad with ID %d and description '%s' was added.%n",
      newExpandedDSA.getId(), newExpandedDSA.getDescription());
}

Python

# Get the AdGroupAdService.
ad_group_ad_service = client.GetService('AdGroupAdService')

# Create the operation
operations = [{
    'operator': 'ADD',
    'operand': {
        'xsi_type': 'AdGroupAd',
        'adGroupId': ad_group_id,
        # Create the expanded dynamic search ad. This ad will have its
        # headline and final URL auto-generated at serving time according to
        # domain name specific information provided by DynamicSearchAdsSetting
        # at the campaign level.
        'ad': {
            'xsi_type': 'ExpandedDynamicSearchAd',
            # Set the ad description.
            'description': 'Buy your tickets now!'
        },
        # Optional: Set the status.
        'status': 'PAUSED',
    }
}]

# Create the ad.
ad = ad_group_ad_service.mutate(operations)['value'][0]['ad']

# Display the results.
print ('Expanded dynamic search ad with ID "%d" and description "%s" was '
       'added' % (ad['id'], ad['description']))

PHP

private static function createExpandedDSA(
      AdWordsServices $adWordsServices,
      AdWordsSession $session,
      AdGroup $adGroup
  ) {
      $adGroupAdService = $adWordsServices->get($session, AdGroupAdService::class);

      // Create the expanded Dynamic Search Ad. This ad will have its headline
      // and final URL auto-generated at serving time according to domain name
      // specific information provided by DynamicSearchAdsSetting at the
      // campaign level.
      $expandedDSA = new ExpandedDynamicSearchAd();
      // Set the ad description.
      $expandedDSA->setDescription('Buy your tickets now!');

      // Create the ad group ad.
      $adGroupAd = new AdGroupAd();
      $adGroupAd->setAdGroupId($adGroup->getId());
      $adGroupAd->setAd($expandedDSA);

      // Optional: Set the status.
      $adGroupAd->setStatus(AdGroupAdStatus::PAUSED);

      // Create the operation.
      $operation = new AdGroupAdOperation();
      $operation->setOperator(Operator::ADD);
      $operation->setOperand($adGroupAd);

      // Create the ad on the server and print some information.
      $result = $adGroupAdService->mutate([$operation]);
      $newAdGroupAd = $result->getValue()[0];
      $expandedDSA = $newAdGroupAd->getAd();
      printf(
          "Expanded Dynamic Search Ad with ID %d and description '%s' was added.\n",
          $expandedDSA->getId(),
          $expandedDSA->getDescription()
      );
  }

Perl

# Creates the expanded Dynamic Search Ad.
sub _create_expanded_DSA {
  my ($client, $ad_group) = @_;
  # Create the expanded Dynamic Search Ad. This ad will have its headline and
  # final URL auto-generated at serving time according to domain name specific
  # information provided by DynamicSearchAdsSetting at the campaign level.
  my $expanded_DSA =
    Google::Ads::AdWords::v201802::ExpandedDynamicSearchAd->new({
      # Set the ad description.
      description => "Buy your tickets now!",
    });

  # Create the ad group ad.
  my $ad_group_ad = Google::Ads::AdWords::v201802::AdGroupAd->new({
    adGroupId => $ad_group->get_id(),
    ad        => $expanded_DSA,
    # Optional: Set the status.
    status => "PAUSED"
  });

  # Create operation.
  my $operation = Google::Ads::AdWords::v201802::AdGroupAdOperation->new({
    operator => "ADD",
    operand  => $ad_group_ad
  });

  my $result =
    $client->AdGroupAdService()->mutate({operations => [$operation]});
  my $new_ad_group_ad = $result->get_value()->[0];
  my $new_expanded_dsa = $new_ad_group_ad->get_ad();
  printf
    "Expanded Dynamic Search Ad with ID %d and description '%s' was added.\n",
    $new_expanded_dsa->get_id(), $new_expanded_dsa->get_description();
}

Ruby

def create_expanded_dsa(adwords, ad_group)
  ad_group_ad_srv = adwords.service(:AdGroupAdService, API_VERSION)

  # Create the expanded Dynamic Search Ad. This ad will have its headline and
  # final URL auto-generated at serving time according to domain name specific
  # information provided by DynamicSearchAdsSetting at the campaign level.
  expanded_dsa = {
    :xsi_type => 'ExpandedDynamicSearchAd',
    :description => 'Buy your tickets now!'
  }

  ad_group_ad = {
    :ad_group_id => ad_group[:id],
    :ad => expanded_dsa,
    # Optional: Set the status.
    :status => 'PAUSED'
  }

  operation = {
    :operand => ad_group_ad,
    :operator => 'ADD'
  }

  new_ad_group_ad = ad_group_ad_srv.mutate([operation])[:value].first
  new_expanded_dsa = new_ad_group_ad[:ad]
  puts "Expanded Dynamic Search Ad with ID %d and description '%s' was added." %
      [new_expanded_dsa[:id], new_expanded_dsa[:description]]
end

動的検索広告の finalUrls フィールドは、動的検索広告の作成時に自動計算されます。そのため、動的検索広告の作成時にはこのフィールドを設定できません。URL トラッキング ソフトウェアを使うには、trackingUrlTemplate フィールドを使って、必要なトラッキング パラメータかリダイレクトを追加で指定します。このフィールドを指定する際は、次のパラメータを 1 つ以上含めて、結果として一致する最終ページ URL を挿入できるようにする必要があります。

パラメータ 説明
{unescapedlpurl}

エスケープされていないランディング ページ URL(末尾にデータを追加する場合)。例:

{unescapedlpurl}?dsa=true

{escapedlpurl}

エスケープされた(URL エンコードされた)ランディング ページ URL(トラッカーにリダイレクトする場合)。例:

http://tracking.com/lp={escapedurl}

{lpurlpath}

計算された URL からのパスと検索語句のパラメータ。例:

http://tracking.com.com/track/{lpurlpath}

{lpurl}

ランディング ページ URL の「?」 と「=」をエンコードし、検索語句で終了します。trackingUrlTemplate フィールドの先頭にある場合、実際には {unescapedurl} の値で置き換えられます。例:

http://tracking.com/redir.php?tracking=xyz&url={lpurl}

例:

dsa.setTrackingUrlTemplate("http://example.org/traveltracker/{escapedlpurl}");

動的検索広告の条件を指定する

最後に、動的検索広告が掲載される条件を設定します。これは Webpage 条件オブジェクトで設定できます。

Webpage 条件には、WebpageParameter オブジェクトを追加します。このオブジェクトには、WebpageConditions を 1~3 個含めることができます。これらのオブジェクトを使うと、上述のキャンペーン設定で指定したドメイン内でフィルタを適用したり検索したりするフィールドを正確に指定できます。

ドメイン内でフィルタを適用できるフィールドは、以下の 4 種類あります。

WebPageConditionOperand 説明
URL ページの URL の一部に一致する文字列。
CATEGORY 正確に一致するカテゴリの文字列。
PAGE_TITLE ページタイトルの一部に一致する文字列。
PAGE_CONTENT インデックス登録されている任意ページ内の一部のコンテンツに一致する文字列。
CUSTOM_LABEL ウェブページのカスタムラベル ターゲティング条件に一致する文字列。詳しくは、カスタムラベルを使用してページフィード URL をターゲティングするをご覧ください。

例として、火星旅行サイトの /children ブランチ内で検索を行うウェブページ条件を作成してみましょう。ただし、タイトルに「Special Offer」という語句が含まれているページのみを対象とします。

サイトのカテゴリを取得する

DataService を使って、サイトが該当するカテゴリ(Google による分類)のリストを取得できます。ドメインまたはキャンペーンには、フィルタを適用できます。たとえば以下のコードでは、特定のキャンペーン内で、サイトのカテゴリのリストを取得しています。

DataServiceInterface dataService =
  adWordsServices.get(session, DataServiceInterface.class);

// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
    .fields("DomainName", "Category", "IsoLanguage")
    .equals("DomainName", "example.org")
    .equals("CampaignId", campaignId)
    .limit(PAGE_SIZE)
    .build();

DomainCategoryPage page = dataService.getDomainCategory(selector);

サイトの一部を除外する

AdGroupCriterionService を使って Webpage 条件を設定し、除外を行うことができます。たとえば、この条件を使って、別のキャンペーンや広告グループから管理する必要がある特定のタイトルを含むページを除外できます。

その他の条件

動的検索広告キャンペーンや広告グループは、Webpage 条件のみで制限されるわけではありません。他の条件タイプを使って、広告の品質を改良、改善できます。ただし、条件は慎重に追加してください。条件が多すぎると、動的検索広告による自動ターゲティングの効果が弱まる場合があります。

動的検索広告のページフィード

デフォルトでは、動的検索広告は、特定のページの URL に絞らずにウェブサイト全体またはその一部をターゲットに設定しています。URL をより詳細に管理する必要がある場合は、動的検索広告のページフィードを使用して、動的検索広告で使用する URL を細かく指定できます。商品やそのランディング ページのページフィードを設定することで、より的確なタイミングで広告を表示したり、ウェブサイトの特定のページにユーザーを誘導したりできるようになります。

動的検索広告ページフィードを設定するには:

  1. フィードを作成し、ページ URL を入力します。
  2. 動的検索広告のページフィードを使用するようにキャンペーンを設定します。
  3. ページフィードの URL にカスタムラベルを追加して、動的検索広告のターゲットを分類、整理することをおすすめします。

ページフィードを作成する

動的検索広告ページフィードを使用するには、まず criterionType = 61 のフィードを作成します。フィード サービスガイドに記載されている手順と似ていますが、次の点が異なります。

  1. 動的検索広告のページフィードは、フィードを作成し、アイテムにデータを入力し、フィードをページフィード プレースホルダ フィールドにマップするだけです。
  2. 動的検索広告のページフィードは、placeholderType フィールドではなく criterionType フィールドを使用します。

実際の例については、コードサンプルのセクションを参照してください。

ページフィードを使用するキャンペーンを設定する

ページフィードを使用する動的検索広告キャンペーンを設定するには、DynamicSearchAdSettingpagefeed プロパティを設定します。

まず、動的検索広告キャンペーンに DynamicSearchAdSetting を取得します。

C#

using (CampaignService campaignService = (CampaignService) user.GetService(
    AdWordsService.v201802.CampaignService)) {

  Selector selector = new Selector() {
    fields = new string[] { Campaign.Fields.Id, Campaign.Fields.Settings },
    predicates = new Predicate[]{
    Predicate.Equals(Campaign.Fields.Id, campaignId)
  },
    paging = Paging.Default
  };

  CampaignPage page = campaignService.get(selector);

  if (page == null || page.entries == null || page.entries.Length == 0) {
    throw new System.ApplicationException(string.Format(
        "Failed to retrieve campaign with ID = {0}.", campaignId));
  }
  Campaign campaign = page.entries[0];

  if (campaign.settings == null) {
    throw new System.ApplicationException("This is not a DSA campaign.");
  }

  DynamicSearchAdsSetting dsaSetting = null;
  Setting[] campaignSettings = campaign.settings;

  for (int i = 0; i < campaign.settings.Length; i++) {
    Setting setting = campaignSettings[i];
    if (setting is DynamicSearchAdsSetting) {
      dsaSetting = (DynamicSearchAdsSetting) setting;
      break;
    }
  }

  if (dsaSetting == null) {
    throw new System.ApplicationException("This is not a DSA campaign.");
  }

Java

// Get the CampaignService.
CampaignServiceInterface campaignService =
    adWordsServices.get(session, CampaignServiceInterface.class);

Selector selector =
    new SelectorBuilder()
        .fields(CampaignField.Id, CampaignField.Settings)
        .equalsId(campaignId)
        .build();

CampaignPage campaignPage = campaignService.get(selector);
if (campaignPage.getEntries() == null || campaignPage.getTotalNumEntries() == 0) {
  throw new IllegalArgumentException("No campaign found with ID: " + campaignId);
}
Campaign campaign = campaignPage.getEntries(0);

if (campaign.getSettings() == null) {
  throw new IllegalArgumentException(
      "Campaign with ID " + campaignId + " is not a DSA campaign.");
}

DynamicSearchAdsSetting dsaSetting = null;
for (Setting setting : campaign.getSettings()) {
  if (setting instanceof DynamicSearchAdsSetting) {
    dsaSetting = (DynamicSearchAdsSetting) setting;
    break;
  }
}

if (dsaSetting == null) {
  throw new IllegalArgumentException(
      "Campaign with ID " + campaignId + " is not a DSA campaign.");
}

Python

# Get the CampaignService.
campaign_service = client.GetService('CampaignService', version='v201802')

selector = {
    'fields': ['Id', 'Settings'],
    'predicates': [{
        'field': 'Id',
        'operator': 'EQUALS',
        'values': [campaign_id]
    }]
}

response = campaign_service.get(selector)

if response['totalNumEntries']:
  campaign = response['entries'][0]
else:
  raise ValueError('No campaign with ID "%d" exists.' % campaign_id)

if not campaign['settings']:
  raise ValueError('This is not a DSA campaign.')

dsa_setting = None

campaign_settings = campaign['settings']

for setting in campaign_settings:
  if setting['Setting.Type'] == 'DynamicSearchAdsSetting':
    dsa_setting = setting
    break

if dsa_setting is None:
  raise ValueError('This is not a DSA campaign.')
    

PHP

$campaignService = $adWordsServices->get($session, CampaignService::class);

// Create selector.
$selector = new Selector();
$selector->setFields(['Id', 'Settings']);
$selector->setPredicates(
    [new Predicate('CampaignId', PredicateOperator::IN, [$campaignId])]
);

$result = $campaignService->get($selector);
if (empty($result->getEntries()) || $result->getTotalNumEntries() === 0) {
    throw new InvalidArgumentException(
        'No campaign found with ID: ' . $campaignId
    );
}
$campaign = $result->getEntries()[0];

if ($campaign->getSettings() === null) {
    throw new InvalidArgumentException(
        'Campaign with ID ' . $campaignId . ' is not a DSA campaign.'
    );
}

$dsaSetting = null;
foreach ($campaign->getSettings() as $setting) {
    if ($setting instanceof DynamicSearchAdsSetting) {
        $dsaSetting = $setting;
        break;
    }
}

if ($dsaSetting === null) {
    throw new InvalidArgumentException(
        'Campaign with ID ' . $campaignId . ' is not a DSA campaign.'
    );
}
    

Perl

my $paging = Google::Ads::AdWords::v201802::Paging->new({
  startIndex    => 0,
  numberResults => PAGE_SIZE
});
my $selector = Google::Ads::AdWords::v201802::Selector->new({
    fields     => ["Id", "Settings"],
    predicates => [
      Google::Ads::AdWords::v201802::Predicate->new({
          field    => "CampaignId",
          operator => "EQUALS",
          values   => [$campaign_id]})
    ],
    paging => $paging
  });

my $dsa_setting = undef;
Google::Ads::AdWords::Utilities::PageProcessor->new({
    client   => $client,
    service  => $client->CampaignService(),
    selector => $selector
  }
  )->process_entries(
  sub {
    my ($campaign) = @_;
    if ($campaign->get_settings()) {
      foreach my $setting (@{$campaign->get_settings()}) {
        if (
          $setting->isa(
            "Google::Ads::AdWords::v201802::DynamicSearchAdsSetting"))
        {
          $dsa_setting = $setting;
          last;
        }
      }
    }
  });

if (!$dsa_setting) {
  die sprintf("Campaign with ID %s is not a DSA campaign.", $campaign_id);
}
    

Ruby

campaign_srv = adwords.service(:CampaignService, API_VERSION)

selector = {
  :fields => ['Id', 'Settings'],
  :predicates => [
    {:field => 'CampaignId', :operator => 'IN', :values => [campaign_id]}
  ]
}

campaign_page = campaign_srv.get(selector)
if campaign_page.nil? or campaign_page[:entries].nil? or
    campaign_page[:total_num_entries] == 0
  raise 'No campaign found with ID: %d' % campaign_id
end

campaign = campaign_page[:entries].first

if campaign[:settings].nil?
  raise 'Campaign with ID %d is not a DSA campaign.' % campaign_id
end

dsa_setting = nil
campaign[:settings].each do |setting|
  if setting[:setting_type] == 'DynamicSearchAdsSetting'
    dsa_setting = setting
    break
  end
end

if dsa_setting.nil?
  raise 'Campaign with ID %d is not a DSA campaign.' % campaign_id
end
    

次に、キャンペーンの DynamicSearchAdsSettingpageFeed プロパティに feedIds を指定して、ページフィードを設定します。useSuppliedUrlsOnly フィールドを使用して、指定した URL のみを動的検索広告に使用するかどうかを指定することも可能です。

C#

  // Use a page feed to specify precisely which URLs to use with your
  // Dynamic Search Ads.
  dsaSetting.pageFeed = new PageFeed() {
    feedIds = new long[] {
      feedId
    },
  };

  // Optional: Specify whether only the supplied URLs should be used with your
  // Dynamic Search Ads.
  dsaSetting.useSuppliedUrlsOnly = true;

  Campaign campaignToUpdate = new Campaign();
  campaignToUpdate.id = campaignId;
  campaignToUpdate.settings = campaignSettings;

  CampaignOperation operation = new CampaignOperation();
  operation.operand = campaignToUpdate;
  operation.@operator = Operator.SET;

  try {
    CampaignReturnValue retval = campaignService.mutate(
        new CampaignOperation[] { operation });
    Campaign updatedCampaign = retval.value[0];
    Console.WriteLine("DSA page feed for campaign ID '{0}' was updated with feed ID '{1}'.",
        updatedCampaign.id, feedId);
  } catch (Exception e) {
    throw new System.ApplicationException("Failed to set page feed for campaign.", e);
  }
}

Java

// Use a page feed to specify precisely which URLs to use with your
// Dynamic Search Ads.
PageFeed pageFeed = new PageFeed();
pageFeed.setFeedIds(new long[] {feedDetails.feedId});
dsaSetting.setPageFeed(pageFeed);

// Optional: Specify whether only the supplied URLs should be used with your
// Dynamic Search Ads.
dsaSetting.setUseSuppliedUrlsOnly(true);

Campaign updatedCampaign = new Campaign();
updatedCampaign.setId(campaignId);
updatedCampaign.setSettings(campaign.getSettings());

CampaignOperation operation = new CampaignOperation();
operation.setOperand(updatedCampaign);
operation.setOperator(Operator.SET);

updatedCampaign = campaignService.mutate(new CampaignOperation[] {operation}).getValue(0);
System.out.printf(
    "DSA page feed for campaign ID %d was updated with feed ID %d.%n",
    updatedCampaign.getId(), feedDetails.feedId);

Python

dsa_setting['pageFeed'] = {
    'feedIds': [feed_id]
}

# Optional: Specify whether only the supplied URLs should be used with your
# Dynamic Search Ads.
dsa_setting['useSuppliedUrlsOnly'] = True

operation = {
    'operand': {
        'id': campaign_id,
        'settings': campaign_settings
    },
    'operator': 'SET'
}

campaign_service.mutate([operation])
print 'DSA page feed for campaign ID "%d" was updated with feed ID "%d".' % (
    campaign_id, feed_id)

PHP

// Use a page feed to specify precisely which URLs to use with your
// Dynamic Search Ads.
$pageFeed = new PageFeed();
$pageFeed->setFeedIds([$feedDetails->feedId]);
$dsaSetting->setPageFeed($pageFeed);

// Optional: Specify whether only the supplied URLs should be used with your
// Dynamic Search Ads.
$dsaSetting->setUseSuppliedUrlsOnly(true);

$updatedCampaign = new Campaign();
$updatedCampaign->setId($campaignId);
$updatedCampaign->setSettings($campaign->getSettings());

$operation = new CampaignOperation();
$operation->setOperand($updatedCampaign);
$operation->setOperator(Operator::SET);

// Update the campaign on the server and print out some information.
$result = $campaignService->mutate([$operation]);
$updatedCampaign = $result->getValue()[0];
printf(
    "DSA page feed for campaign ID %d was updated with feed ID %d.\n",
    $updatedCampaign->getId(),
    $feedDetails->feedId
);

Perl

# Use a page feed to specify precisely which URLs to use with your
# Dynamic Search Ads.
my $page_feed = Google::Ads::AdWords::v201802::PageFeed->new({
    feedIds => [$feed_details->{"feedId"}]});
$dsa_setting->set_pageFeed($page_feed);

# Optional: Specify whether only the supplied URLs should be used with your
# Dynamic Search Ads.
$dsa_setting->set_useSuppliedUrlsOnly(1);

my $updated_campaign = Google::Ads::AdWords::v201802::Campaign->new({
    id       => $campaign_id,
    settings => [$dsa_setting]});

my $operation = Google::Ads::AdWords::v201802::CampaignOperation->new({
  operand  => $updated_campaign,
  operator => "SET"
});

$client->CampaignService()->mutate({operations => [$operation]});
printf(
  "DSA page feed for campaign ID %d was updated with feed ID %d.\n",
  $updated_campaign->get_id(),
  $feed_details->{"feedId"});

Ruby

# Use a page feed to specify precisely which URLs to use with your Dynamic
# Search Ads.
page_feed = {
  :feed_ids => [feed_details[:feed_id]]
}
dsa_setting[:page_feed] = page_feed

# Optional: Specify whether only the supplied URLs should be used with your
# Dynamic Search Ads.
dsa_setting[:use_supplied_urls_only] = true

updated_campaign = {
  :id => campaign_id,
  :settings => campaign[:settings]
}

operation = {
  :operand => updated_campaign,
  :operator => 'SET'
}

updated_campaign = campaign_srv.mutate([operation])[:value].first
puts "DSA page feed for campaign ID %d was updated with feed ID %d." % [
  updated_campaign[:id], feed_details[:feed_id]
]

上記の設定は、次のように AdWords 管理画面にマッピングされます。

useSuppliedUrlsOnly pageFeed.feedIds AdWords 管理画面での設定
false 該当なし ウェブサイトの Google インデックスを使用します。
false 1 つ以上のフィード ID が指定されている ウェブサイトの Google インデックスとページフィードの両方の URL を使用します。
true 1 つ以上のフィード ID が指定されている ページフィードの URL のみを使用します。
true 空または null サポート対象外です。API は、SettingError.DYNAMIC_SEARCH_ADS_SETTING_AT_LEAST_ONE_FEED_ID_MUST_BE_PRESENT エラーを返します。

カスタムラベルを使用してページフィード URL をターゲティングする

カスタムラベルを使うことで、ページフィードの URL をターゲットにして入札単価を設定することも可能です。この設定を行うには、operandCUSTOM_LABEL としてフィルタリングする Webpage 条件を作成します。

C#

private static BiddableAdGroupCriterion AddDsaTargeting(AdWordsUser user, long adGroupId,
    string labelName) {
  using (AdGroupCriterionService adGroupCriterionService =
      (AdGroupCriterionService) user.GetService(
          AdWordsService.v201802.AdGroupCriterionService)) {

    // Create a webpage criterion.
    Webpage webpage = new Webpage();

    WebpageParameter parameter = new WebpageParameter();
    parameter.criterionName = "Test criterion";
    webpage.parameter = parameter;

    // Add a condition for label=specified_label_name.
    WebpageCondition condition = new WebpageCondition();
    condition.operand = WebpageConditionOperand.CUSTOM_LABEL;
    condition.argument = labelName;
    parameter.conditions = new WebpageCondition[] { condition };

    BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
    criterion.adGroupId = adGroupId;
    criterion.criterion = webpage;

    // Set a custom bid for this criterion.
    BiddingStrategyConfiguration biddingStrategyConfiguration =
        new BiddingStrategyConfiguration();

    biddingStrategyConfiguration.bids = new Bids[] {
    new CpcBid() {
      bid = new Money() {
        microAmount = 1500000
      }
    }
  };

    criterion.biddingStrategyConfiguration = biddingStrategyConfiguration;

    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.operand = criterion;
    operation.@operator = Operator.ADD;

    try {
      AdGroupCriterionReturnValue retval = adGroupCriterionService.mutate(
          new AdGroupCriterionOperation[] { operation });
      BiddableAdGroupCriterion newCriterion = (BiddableAdGroupCriterion) retval.value[0];

      Console.WriteLine("Web page criterion with ID = {0} and status = {1} was created.",
        newCriterion.criterion.id, newCriterion.userStatus);
      return newCriterion;
    } catch (Exception e) {
      throw new System.ApplicationException("Failed to create webpage criterion for " +
          "custom page feed label.", e);
    }
  }
}
    

Java

private static void addDsaTargeting(
    AdWordsServicesInterface adWordsServices,
    AdWordsSession session,
    Long adGroupId,
    String dsaPageUrlLabel)
    throws ApiException, RemoteException {
  // Get the AdGroupCriterionService.
  AdGroupCriterionServiceInterface adGroupCriterionService =
      adWordsServices.get(session, AdGroupCriterionServiceInterface.class);

  // Create a webpage criterion.
  Webpage webpage = new Webpage();

  WebpageParameter parameter = new WebpageParameter();
  parameter.setCriterionName("Test criterion");
  webpage.setParameter(parameter);

  // Add a condition for label=specified_label_name.
  WebpageCondition condition = new WebpageCondition();
  condition.setOperand(WebpageConditionOperand.CUSTOM_LABEL);
  condition.setArgument(dsaPageUrlLabel);
  parameter.setConditions(new WebpageCondition[] {condition});

  BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
  criterion.setAdGroupId(adGroupId);
  criterion.setCriterion(webpage);

  // Set a custom bid for this criterion.
  BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();

  CpcBid cpcBid = new CpcBid();
  Money money = new Money();
  money.setMicroAmount(1_500_000L);
  cpcBid.setBid(money);
  biddingStrategyConfiguration.setBids(new Bids[] {cpcBid});

  criterion.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

  AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
  operation.setOperand(criterion);
  operation.setOperator(Operator.ADD);

  BiddableAdGroupCriterion newCriterion =
      (BiddableAdGroupCriterion)
          adGroupCriterionService.mutate(new AdGroupCriterionOperation[] {operation}).getValue(0);
  System.out.printf(
      "Web page criterion with ID %d and status '%s' was created.%n",
      newCriterion.getCriterion().getId(), newCriterion.getUserStatus());
}
    

Python

# Get the AdGroupCriterionService.
ad_group_criterion_service = client.GetService('AdGroupCriterionService',
                                               version='v201802')

# Create the operation.
operation = {
    'operand': {
        'xsi_type': 'BiddableAdGroupCriterion',
        'adGroupId': ad_group_id,
        # Create a webpage criterion.
        'criterion': {
            'xsi_type': 'Webpage',
            'parameter': {
                'criterionName': 'Test criterion',
                # Add a condition for label=specified_label_name.
                'conditions': [{
                    'operand': 'CUSTOM_LABEL',
                    'argument': label_name
                }],
            }
        },
        # Set a custom bid for this criterion
        'biddingStrategyConfiguration': {
            'bids': [{
                'xsi_type': 'CpcBid',
                'bid': {
                    'microAmount': 1500000
                }
            }]
        }
    },
    'operator': 'ADD'
}

criterion = ad_group_criterion_service.mutate([operation])['value'][0]
print 'Web page criterion with ID "%d" and status "%s" was created.' % (
    criterion['criterion']['id'], criterion['userStatus'])
return criterion
    

PHP

private static function addDsaTargeting(
    AdWordsServices $adWordsServices,
    AdWordsSession $session,
    $adGroupId,
    $dsaPageUrlLabel
) {
    $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

    // Create a webpage criterion.
    $webpage = new Webpage();

    $parameter = new WebpageParameter();
    $parameter->setCriterionName('Test criterion');
    $webpage->setParameter($parameter);

    // Add a condition for label=specified_label_name.
    $condition = new WebpageCondition();
    $condition->setOperand(WebpageConditionOperand::CUSTOM_LABEL);
    $condition->setArgument($dsaPageUrlLabel);
    $parameter->setConditions([$condition]);

    $criterion = new BiddableAdGroupCriterion();
    $criterion->setAdGroupId($adGroupId);
    $criterion->setCriterion($webpage);

    // Set a custom bid for this criterion.
    $biddingStrategyConfiguration = new BiddingStrategyConfiguration();

    $cpcBid = new CpcBid();
    $money = new Money();
    $money->setMicroAmount(1500000);
    $cpcBid->setBid($money);
    $biddingStrategyConfiguration->setBids([$cpcBid]);

    $criterion->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

    $operation = new AdGroupCriterionOperation();
    $operation->setOperand($criterion);
    $operation->setOperator(Operator::ADD);

    // Create ad group criterion on the server and print out some information.
    $result = $adGroupCriterionService->mutate([$operation]);
    $criterion = $result->getValue()[0];
    printf(
        "Web page criterion with ID %d and status '%s' was created.\n",
        $criterion->getCriterion()->getId(),
        $criterion->getUserStatus()
    );
}

    

Perl

sub _add_dsa_targeting {
  my ($client, $ad_group_id, $dsa_page_url_label) = @_;

  # Create a webpage criterion.
  # Add a condition for label=specified_label_name.
  my $condition = Google::Ads::AdWords::v201802::WebpageCondition->new({
    operand  => "CUSTOM_LABEL",
    argument => $dsa_page_url_label
  });

  # Create a webpage criterion for special offers.
  my $parameter = Google::Ads::AdWords::v201802::WebpageParameter->new({
      criterionName => "Test criterion",
      conditions    => [$condition]});

  my $webpage = Google::Ads::AdWords::v201802::Webpage->new({
    parameter => $parameter
  });

  # Create biddable ad group criterion.
  my $biddable_ad_group_criterion =
    Google::Ads::AdWords::v201802::BiddableAdGroupCriterion->new({
      adGroupId => $ad_group_id,
      criterion => $webpage,
      # Set a custom bid for this criterion.
      biddingStrategyConfiguration =>
        Google::Ads::AdWords::v201802::BiddingStrategyConfiguration->new({
          bids => [
            Google::Ads::AdWords::v201802::CpcBid->new({
                bid => Google::Ads::AdWords::v201802::Money->new(
                  {microAmount => 1500000}
                ),
              }
            ),
          ]})});

  # Create operation.
  my $operation =
    Google::Ads::AdWords::v201802::AdGroupCriterionOperation->new({
      operator => "ADD",
      operand  => $biddable_ad_group_criterion
    });

  # Create the criterion.
  my $result =
    $client->AdGroupCriterionService()->mutate({operations => [$operation]});
  my $new_ad_group_criterion = $result->get_value()->[0];
  printf "Web page criterion with ID %d and status '%s' was created.\n",
    $new_ad_group_criterion->get_criterion()->get_id(),
    $new_ad_group_criterion->get_userStatus();
}
    

Ruby

def add_dsa_targeting(adwords, ad_group_id, dsa_page_url_label)
  ad_group_criterion_srv =
      adwords.service(:AdGroupCriterionService, API_VERSION)

  webpage = {
    :xsi_type => 'Webpage',
    :parameter => {
      :criterion_name => 'Test criterion',
      :conditions => [{
        :operand => 'CUSTOM_LABEL',
        :argument => dsa_page_url_label
      }]
    }
  }

  bidding_strategy_configuration = {
    :bids => [{
      :xsi_type => 'CpcBid',
      :bid => {
        :micro_amount => 1_500_000
      }
    }]
  }

  criterion = {
    :xsi_type => 'BiddableAdGroupCriterion',
    :ad_group_id => ad_group_id,
    :criterion => webpage,
    :bidding_strategy_configuration => bidding_strategy_configuration
  }

  operation = {
    :operand => criterion,
    :operator => 'ADD'
  }

  new_criterion = ad_group_criterion_srv.mutate([operation])[:value].first
  puts "Web page criterion with ID %d and status '%s' was created." %
      [new_criterion[:criterion][:id], new_criterion[:user_status]]
end
    

レポート

動的検索広告に関する 3 種類のレポートをダウンロードできます。

条件パフォーマンス レポート

このレポートの Parameter または Dynamic ad target フィールドには、条件オブジェクトが WebpageCriterion タイプだった場合、このオブジェクトに関連する WebpageParameter の名前が含まれます。このフィールドは「属性」タイプであるため、固定データ、すなわち、掲載結果データに関連する WebpageParameter が含まれることになります。

キーワードレス カテゴリ レポート

キーワードレス カテゴリ パフォーマンス レポートには、カテゴリ別に集計された動的検索広告用のキーワードのない広告が含まれます。このレポートは、表示回数 0 の行を返しません。Category0Category1Category2 フィールドには、成果に関連するカテゴリとサブカテゴリの情報が含まれます。

トップレベル カテゴリ 第 1 階層のサブカテゴリ 第 2 階層のサブカテゴリ クリック数 表示回数 日付 費用
旅行、観光 地球外 火星 1 71 2014 年 6 月 20 日 0.05
旅行、観光 冒険旅行 0 279 2014 年 6 月 21 日 0

キーワードレス検索語句レポート

キーワードレス検索語句パフォーマンス レポートには、検索語句に基づいた動的検索広告の統計が含まれます。このレポートは、表示回数 0 の行を返しません。Query フィールドには、成果につながった一致する検索語句が含まれます。

検索語句 クリック数 表示回数 日付 費用 URL
火星 贅沢 0 20 2014 年 6 月 20 日 0 http://example.org/LuxuryMarsCruises
火星 贅沢 0 14 2014 年 6 月 21 日 0 http://example.org/LuxuryMarsCruises
格安 火星 0 24 2014 年 6 月 20 日 0 http://example.org/MarsOnABudget
格安 火星 0 18 2014 年 6 月 21 日 0 http://example.org/MarsOnABudget
火星 ランドマーク 0 130 2014 年 6 月 21 日 0 http://example.org/MajorTouristSpots
火星 ファニー フェイス 0 44 2014 年 6 月 21 日 0 http://example.org/MajorTouristSpots
宇宙旅行 安全 1 3 2014 年 6 月 20 日 0.05 http://example.org/ButIsItSafe
火星 出発地 0 11 2014 年 6 月 21 日 0 http://example.org/HowToGetToMars
火星 ビーチ 0 24 2014 年 6 月 20 日 0 http://example.org/MarsBeachVacations
火星 ビーチ 0 39 2014 年 6 月 21 日 0 http://example.org/MarsBeachVacations
火星 キャニオニング 0 23 2014 年 6 月 21 日 0 http://example.org/DayTripsAndActivities
合計 1 350 -- 0.05 --

コードサンプル

動的検索広告で使用する完全なコードサンプルは、各クライアント ライブラリでご確認いただけます。

フィードバックを送信...

ご不明な点がありましたら、Google のサポートページをご覧ください。