Visão geral de anúncios

Este guia fornece uma visão geral dos vários tipos de anúncios e recursos disponíveis na API, da perspectiva de um caso de uso típico.

Cenário

Digamos que você seja o feliz proprietário da Loja Intergaláctica de Violões e pretenda lançar uma campanha publicitária para atrair novos clientes. As seções a seguir descrevem os diferentes tipos de anúncios e recursos que você pode usar para atingir esse objetivo.

Onde você deseja que seus anúncios sejam exibidos?

Os anúncios do Google AdWords podem ser exibidos em duas redes:

  • A Rede de Pesquisa, que inclui páginas de resultados de pesquisa e outros sites do Google, como o Google Maps e o Google Shopping, além de sites de pesquisa de parceiros.
  • A Rede de Display, que inclui sites do Google, como YouTube, Blogger e Gmail, além de milhares de websites parceiros em toda a Internet.

Digamos que você queira anunciar nas duas redes, mas não queira gerenciar uma campanha da rede de pesquisa e outra da Rede de Display separadamente. Então, cria uma campanha da Rede de pesquisa com exibição em Display com um único grupo de anúncios.

Veja o exemplo de código AddCampaigns na pasta de exemplos de operações básicas da biblioteca cliente para mais detalhes.

Qual tipo de anúncio você deseja?

Agora que você sabe onde seus anúncios serão exibidos, é hora de escolher o tipo de anúncio que melhor atende às suas necessidades. A AdWords API oferece os seguintes tipos de anúncio:

Tipo Rede de Pesquisa Descrição
ExpandedTextAd

Sim

Sim

Novo padrão dos anúncios de texto do Google AdWords. Inclui dois títulos, uma descrição do seu produto ou serviço, localização atual de navegação e um URL visível gerado.

ProductAd

Sim

Não

Um anúncio de produto (chamado de anúncio do Shopping na IU do Google AdWords) baseia-se nos dados do produto de uma conta do Merchant Center associada a uma campanha do Shopping.

DynamicSearchAd

Sim

Não

Anúncios da rede de pesquisa gerados de forma dinâmica com base no conteúdo de um site.

ResponsiveDisplayAd

Não

Sim

Contém uma imagem de marketing, um título curto e um longo, uma descrição e um nome e um logotipo de anunciante opcionais.

GmailAd

Não

Sim

Um anúncio para uma campanha do Gmail.

CallOnlyAd

Não

Sim

Um anúncio de uma campanha só "clique para ligar".

ImageAd

Sim1

Sim

Um anúncio que inclui uma imagem para promover sua empresa.

TemplateAd

Sim2

Sim2

Um anúncio com base em um modelo predefinido.

1 Um ImageAd na rede de pesquisa é exibido apenas em sites de parceiros de pesquisa do Google, não na Pesquisa Google.

2 Consulte a lista de modelos TemplateAd e o guia de anúncios modelo para mais informações, inclusive com quais redes cada código de modelo é compatível.

Para esse cenário, digamos que você comece com o tipo de anúncio mais comum, um ExpandedTextAd, e use o mesmo ExpandedTextAd para anunciar nas redes de pesquisa e de Display.

Configuração do anúncio de texto expandido

ExpandedTextAd é um objeto relativamente simples. Basta especificar os seguintes atributos:

  • HeadlinePart1 – Primeira parte do título.
  • HeadlinePart2 – Segunda parte do título.
  • Description – O texto descritivo do anúncio.
  • FinalUrls – Os URLs da página no seu site que as pessoas acessam ao clicar no anúncio.

Consulte o exemplo de AddExpandedTextAds na pasta de amostras operações básicas da biblioteca de cliente para ver um exemplo completo.

Configuração de anúncios do Gmail

Um GmailAd só pode ser criado em uma campanha que tenha o advertisingChannelType definido como DISPLAY e o advertisingChannelSubType como DISPLAY_GMAIL_AD. Ao criar um GmailAd, é preciso considerar os seguintes itens:

Confira o exemplo de AddGmailAds na pasta de amostras de operações avançadas da sua biblioteca de cliente para ver um exemplo completo.

Como adicionar extensões de anúncio

Você pode começar com um ExpandedTextAd básico no seu grupo de anúncios. No entanto, você perceberá que existem outros anúncios nas redes de Pesquisa e Display que contêm informações, links e botões de ação adicionais.

Essas informações adicionais são provenientes de extensões de anúncio. Grande parte das extensões de anúncio é gerenciada por serviços de feed na AdWords API. É possível melhorar seus anúncios usando extensões de anúncio com:

  • Sitelinks que exibem links adicionais de páginas específicas do seu website.
  • Extensões de local que exibem seu endereço comercial, número de telefone, um marcador do mapa da sua empresa no texto do seu anúncio e, em dispositivos móveis, um link com trajetos para a sua empresa.
  • Extensões de aplicativos que exibem um link para o seu aplicativo para celular ou tablet.
  • Extensões de frase de destaque que exibem mais informações detalhadas sobre sua empresa, incluindo os produtos e serviços oferecidos.
  • Extensões de comentário que exibem um comentário positivo, prêmio ou classificação de terceiros em uma linha de texto adicional embaixo do seu anúncio na Pesquisa Google.

Como proprietário da Loja Intergaláctica de Violões, você quer que as pessoas saibam que a loja:

  • oferece serviços de manutenção;
  • faz serviços em violões e guitarras;
  • oferece aulas de violão.

Essas informações são ótimas para extensões de sitelinks.

Para configurar extensões de sitelinks, leia as instruções no guia Serviços de configuração de extensões, que inclui um link para um código de exemplo completo para cada biblioteca cliente.

Adição de extensões de local

Seu anúncio está pronto e exibe links para várias áreas do seu site, mas convém que os usuários encontrem sua loja com facilidade, principalmente se eles estiverem visualizando o anúncio em um dispositivo móvel.

Se você já inseriu essas informações na sua conta do Google Meu Negócio, agora fica fácil: basta vincular sua conta do Google Meu Negócio à sua conta do Google AdWords, e o Google AdWords exibirá o local nos seus anúncios.

Consulte o guia Extensões de local para ver instruções detalhadas e exemplos de código.

Mais extensões de anúncio

Agora que você configurou extensões de sitelinks e de local para a sua campanha, a adição de outras extensões, como de aplicativo, de frase de destaque e de comentários, será semelhante. A única diferença será o tipo de ExtensionFeedItem usado com os serviços de configuração de extensões.

O guia Serviços de configuração de extensões inclui exemplos de cada tipo de extensão.

Rotação de anúncios

Se você tiver vários anúncios em um grupo, eles serão alternados porque apenas um pode ser exibido por vez. É possível usar a configuração de rotação de anúncios para especificar o intervalo em que os anúncios do seu grupo devem ser veiculados um em relação ao outro.

Há duas configurações para a rotação de anúncios:

  • Otimizar: essa configuração prioriza os anúncios com mais chances de ter um desempenho melhor do que os outros anúncios do grupo. Esta é a configuração padrão.
  • Alternar indefinidamente: essa configuração exibe seus anúncios de maneira mais uniforme no leilão de anúncios, mas faz isso por um período indefinido e sem otimização.

As configurações de rotação de anúncios são especificadas no nível do grupo de anúncios usando a propriedade adGroupAdRotationMode dele. Você pode remover a configuração de rotação de anúncios ao enviar um AdGroupAdRotationMode com o adRotationMode definido como null.

Programação de anúncios

Na publicidade, como muitas coisas na vida, tempo é tudo. Muitas empresas têm necessidades de publicidade especiais em determinados horários do dia e querem segmentar clientes em momentos específicos. Ao incorporar a programação de anúncios às suas campanhas, você exibe os anúncios nos horários em que eles são mais úteis, o que resulta em uma segmentação mais focada e retornos maiores.

A programação de anúncios permite que você decida de forma programática quando veicular seus anúncios, sem precisar ativá-los e desativá-los manualmente.

A programação ocorre no nível da campanha, ou seja, aplica-se a todos os grupos de anúncios e anúncios ativos dentro dela. Isso é gerenciado pelo CampaignCriterionService e um dos tipos de critério dele, o AdSchedule.

Todo critério AdSchedule permite a definição de várias propriedades, como o dia da semana, os horários de início e término e um modificador de lance (que antigamente era gerenciado pelo bid_multiplier do CampaignTargetService). Com os modificadores, é possível aumentar ou diminuir os lances em horários especificados.

Exemplos de código

Para garantir a veiculação dos anúncios durante a maior parte do horário de funcionamento, configure o horário de início dos anúncios para um pouco antes de abrir a loja e o horário de término para um pouco antes de fechar:

Java

// Closed on Sunday, so don't configure an AdSchedule for Sunday.
List<DayOfWeek> mondayThroughSaturday =
    Arrays.asList(
        DayOfWeek.MONDAY,
        DayOfWeek.TUESDAY,
        DayOfWeek.WEDNESDAY,
        DayOfWeek.THURSDAY,
        DayOfWeek.FRIDAY,
        DayOfWeek.SATURDAY);

// Creates an operation to add an AdSchedule for each day of the week in the list.
List<CampaignCriterionOperation> operations = new ArrayList<>();
for (DayOfWeek dayOfWeek : mondayThroughSaturday) {
  AdSchedule schedule = new AdSchedule();
  schedule.setDayOfWeek(dayOfWeek);
  // Start at 8:45 am...
  schedule.setStartHour(8);
  schedule.setStartMinute(MinuteOfHour.FORTY_FIVE);
  // ... and end at 7:45 pm
  schedule.setEndHour(19);
  schedule.setEndMinute(MinuteOfHour.FORTY_FIVE);
  CampaignCriterionOperation operation = new CampaignCriterionOperation();
  CampaignCriterion campaignCriterion = new CampaignCriterion();

  campaignCriterion.setCampaignId(campaignId);
  campaignCriterion.setCriterion(schedule);
  // Run at normal bid rates
  campaignCriterion.setBidModifier(1.0);
  operation.setOperand(campaignCriterion);
  operation.setOperator(Operator.ADD);
  operations.add(operation);
}

CampaignCriterionReturnValue result =
    campaignCriterionService.mutate(
        operations.toArray(new CampaignCriterionOperation[operations.size()]));

CSharp

// Closed on Sunday, so don't configure an AdSchedule for Sunday.
List<DayOfWeek> mondayThroughSaturday = new List<DayOfWeek>() {
  DayOfWeek.MONDAY,
  DayOfWeek.TUESDAY,
  DayOfWeek.WEDNESDAY,
  DayOfWeek.THURSDAY,
  DayOfWeek.FRIDAY,
  DayOfWeek.SATURDAY
};

// Creates an operation to add an AdSchedule for each day of the week in the list.
List<CampaignCriterionOperation> operations = new List<CampaignCriterionOperation>();
foreach (DayOfWeek dayOfWeek in mondayThroughSaturday) {
  AdSchedule schedule = new AdSchedule();
  schedule.dayOfWeek = dayOfWeek;
  // Start at 8:45 am...
  schedule.startHour = 8;
  schedule.startMinute = MinuteOfHour.FORTY_FIVE;
  // ... and end at 7:45 pm
  schedule.endHour = 19;
  schedule.endMinute = MinuteOfHour.FORTY_FIVE;
  CampaignCriterionOperation operation = new CampaignCriterionOperation();
  CampaignCriterion campaignCriterion = new CampaignCriterion();

  campaignCriterion.campaignId = campaignId;
  campaignCriterion.criterion = schedule;
  // Run at normal bid rates
  campaignCriterion.bidModifier = 1.0;
  operation.operand = campaignCriterion;
  operation.@operator = Operator.ADD;
  operations.Add(operation);
}

CampaignCriterionReturnValue result =
    campaignCriterionService.mutate(operations.ToArray());

Python

# Closed on Sunday, so don't configure an AdSchedule for Sunday.
monday_through_saturday = [
    'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY'
]

# Creates an operation to add an AdSchedule for each day of the week in the
# list.
operations = [{
    'operator': 'ADD',
    'operand': {
        'campaignId': campaign_id,
        'criterion': {
            'xsi_type': 'AdSchedule',
            'dayOfWeek': day,
            # Start at 8:45 A.M.
            'startHour': 8,
            'startMinute': 'FORTY_FIVE',
            # End at 7:45 P.M.
            'endHour': 19,
            'endMinute': 'FORTY_FIVE',
        },
        # Run at normal bid rates.
        'bidModifier': 1.0
    }
} for day in monday_through_saturday]

result = campaign_criterion_service.mutate(operations)

PHP

// Closed on Sunday, so don't configure an AdSchedule for Sunday.
$mondayThroughSaturday = [
    DayOfWeek::MONDAY,
    DayOfWeek::TUESDAY,
    DayOfWeek::WEDNESDAY,
    DayOfWeek::THURSDAY,
    DayOfWeek::FRIDAY,
    DayOfWeek::SATURDAY
];

// Creates an operation to add an AdSchedule for each day of the week in the
// list.
$operations = [];
foreach ($mondayThroughSaturday as $dayOfWeek) {
    $schedule = new AdSchedule();
    $schedule->setDayOfWeek($dayOfWeek);
    // Start at 8:45 am...
    $schedule->setStartHour(8);
    $schedule->setStartMinute(MinuteOfHour::FORTY_FIVE);
    // ... and end at 7:45 pm
    $schedule->setEndHour(19);
    $schedule->setEndMinute(MinuteOfHour::FORTY_FIVE);

    $campaignCriterion = new CampaignCriterion();
    $campaignCriterion->setCampaignId($campaignId);
    $campaignCriterion->setCriterion($schedule);
    // Run at normal bid rates
    $campaignCriterion->setBidModifier(1.0);

    $operation = new CampaignCriterionOperation();
    $operation->setOperand($campaignCriterion);
    $operation->setOperator(Operator::ADD);
    $operations[] = $operation;
}

$result = $campaignCriterionService->mutate($operations);

Perl

# Closed on Sunday, so don't configure an AdSchedule for Sunday.
my @monday_through_saturday =
  ('MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY');

# Creates an operation to add an AdSchedule for each day of the week in the list.
my @operations = ();
foreach my $day_of_week (@monday_through_saturday) {
  my $schedule = Google::Ads::AdWords::v201802::AdSchedule->new({
    dayOfWeek => $day_of_week,
    # Start at 8:45 am...
    startHour   => '8',
    startMinute => 'FORTY_FIVE',
    # ... and end at 7:45 pm
    endHour   => '19',
    endMinute => 'FORTY_FIVE'
  });

  my $campaign_criterion =
    Google::Ads::AdWords::v201802::CampaignCriterion->new({
      campaignId => $campaign_id,
      criterion  => $schedule,
      # Run at normal bid rates
      bidModifier => '1.0'
    });

  my $operation =
    Google::Ads::AdWords::v201802::CampaignCriterionOperation->new({
      operand  => $campaign_criterion,
      operator => 'ADD'
    });

  push @operations, $operation;
}

my $result =
  $client->CampaignCriterionService()->mutate({operations => \@operations});

Ruby

# Closed on Sunday, so don't configure an AdSchedule for Sunday.
monday_through_saturday = [
  'MONDAY',
  'TUESDAY',
  'WEDNESDAY',
  'THURSDAY',
  'FRIDAY',
  'SATURDAY'
]

# Creates an operation to add an AdSchedule for each day of the week in the
# list.
operations = monday_through_saturday.map do |day_of_week|
  schedule = {
    :xsi_type => 'AdSchedule',
    :day_of_week => day_of_week,
    # Start at 8:45 AM...
    :start_hour => 8,
    :start_minute => 'FORTY_FIVE',
    # ...and end at 7:45 PM.
    :end_hour => 19,
    :end_minute => 'FORTY_FIVE'
  }

  campaign_criterion = {
    :campaign_id => campaign_id,
    :criterion => schedule,
    :bid_modifier => 1.0
  }

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

  next operation
end

result = campaign_criterion_srv.mutate(operations)

VB.NET

' Closed on Sunday, so don't configure an AdSchedule for Sunday.
Dim mondayThroughSaturday As DayOfWeek() = {
  DayOfWeek.MONDAY,
  DayOfWeek.TUESDAY,
  DayOfWeek.WEDNESDAY,
  DayOfWeek.THURSDAY,
  DayOfWeek.FRIDAY,
  DayOfWeek.SATURDAY
}

' Creates an operation to add an AdSchedule for each day of the week in the list.
Dim operations As New List(Of CampaignCriterionOperation)()
For Each dayOfWeek As DayOfWeek In mondayThroughSaturday
  Dim schedule As New AdSchedule()
  schedule.dayOfWeek = dayOfWeek
  ' Start at 8:45 am...
  schedule.startHour = 8
  schedule.startMinute = MinuteOfHour.FORTY_FIVE
  ' ... And end at 7:45 pm
  schedule.endHour = 19
  schedule.endMinute = MinuteOfHour.FORTY_FIVE
  Dim operation As New CampaignCriterionOperation()
  Dim campaignCriterion As New CampaignCriterion()

  campaignCriterion.campaignId = campaignId
  campaignCriterion.criterion = schedule
  ' Run at normal bid rates
  campaignCriterion.bidModifier = 1.0
  operation.operand = campaignCriterion
  operation.operator = [Operator].ADD
  operations.Add(operation)
Next

Dim result As CampaignCriterionReturnValue =
    campaignCriterionService.mutate(operations.ToArray())

Para avisar aos clientes sobre uma oferta especial de almoço às segundas-feiras com antecedência, comece a fazer a publicidade de manhã cedo e aumente de modo significativo durante os horários da promoção:

Java

List<CampaignCriterionOperation> operations = new ArrayList<>();

// Create operations to remove any existing ad schedules for Monday. Ad schedules cannot
// overlap.
for (Long existingCriterionId : existingCriteriaIds) {
  CampaignCriterion campaignCriterion = new CampaignCriterion();
  campaignCriterion.setCampaignId(campaignId);
  AdSchedule adSchedule = new AdSchedule();
  adSchedule.setId(existingCriterionId);
  campaignCriterion.setCriterion(adSchedule);

  CampaignCriterionOperation removeOperation = new CampaignCriterionOperation();
  removeOperation.setOperand(campaignCriterion);
  removeOperation.setOperator(Operator.REMOVE);

  operations.add(removeOperation);
}

// Create a schedule for 8:00 AM to 12:00 PM (noon) with no change to bids.
AdSchedule early = new AdSchedule();
early.setDayOfWeek(DayOfWeek.MONDAY);
early.setStartHour(8);
early.setStartMinute(MinuteOfHour.ZERO);
early.setEndHour(12);
early.setEndMinute(MinuteOfHour.ZERO);

CampaignCriterion campaignCriterionEarly = new CampaignCriterion();
// Run at normal bid rates.
campaignCriterionEarly.setBidModifier(1.0);
campaignCriterionEarly.setCampaignId(campaignId);
campaignCriterionEarly.setCriterion(early);

// Create a schedule for 12:00 PM (noon) to 2:00 PM with bids doubled.
AdSchedule peak = new AdSchedule();
peak.setDayOfWeek(DayOfWeek.MONDAY);
peak.setStartHour(12);
peak.setStartMinute(MinuteOfHour.ZERO);
peak.setEndHour(14);
peak.setEndMinute(MinuteOfHour.ZERO);

CampaignCriterion campaignCriterionPeak = new CampaignCriterion();
// Double the bid.
campaignCriterionPeak.setBidModifier(2.0);
campaignCriterionPeak.setCampaignId(campaignId);
campaignCriterionPeak.setCriterion(peak);

// Create operations to add the new schedules.
CampaignCriterionOperation operationEarly = new CampaignCriterionOperation();
operationEarly.setOperand(campaignCriterionEarly);
operationEarly.setOperator(Operator.ADD);
operations.add(operationEarly);

CampaignCriterionOperation operationPeak = new CampaignCriterionOperation();
operationPeak.setOperand(campaignCriterionPeak);
operationPeak.setOperator(Operator.ADD);
operations.add(operationPeak);

campaignCriterionService.mutate(
    operations.toArray(new CampaignCriterionOperation[operations.size()]));

CSharp

List<CampaignCriterionOperation> operations = new List<CampaignCriterionOperation>();

// Create operations to remove any existing ad schedules for Monday. Ad schedules cannot
// overlap.
foreach (long existingCriterionId in existingCriteriaIds) {
  CampaignCriterion campaignCriterion = new CampaignCriterion();
  campaignCriterion.campaignId = campaignId;
  AdSchedule adSchedule = new AdSchedule();
  adSchedule.id = existingCriterionId;
  campaignCriterion.criterion = adSchedule;

  CampaignCriterionOperation removeOperation = new CampaignCriterionOperation();
  removeOperation.operand = campaignCriterion;
  removeOperation.@operator = Operator.REMOVE;

  operations.Add(removeOperation);
}

// Create a schedule for 8:00 AM to 12:00 PM (noon) with no change to bids.
AdSchedule early = new AdSchedule();
early.dayOfWeek = DayOfWeek.MONDAY;
early.startHour = 8;
early.startMinute = MinuteOfHour.ZERO;
early.endHour = 12;
early.endMinute = MinuteOfHour.ZERO;

CampaignCriterion campaignCriterionEarly = new CampaignCriterion();
// Run at normal bid rates.
campaignCriterionEarly.bidModifier = 1.0;
campaignCriterionEarly.campaignId = campaignId;
campaignCriterionEarly.criterion = early;

// Create a schedule for 12:00 PM (noon) to 2:00 PM with bids doubled.
AdSchedule peak = new AdSchedule();
peak.dayOfWeek = DayOfWeek.MONDAY;
peak.startHour = 12;
peak.startMinute = MinuteOfHour.ZERO;
peak.endHour = 14;
peak.endMinute = MinuteOfHour.ZERO;

CampaignCriterion campaignCriterionPeak = new CampaignCriterion();
// Double the bid.
campaignCriterionPeak.bidModifier = 2.0;
campaignCriterionPeak.campaignId = campaignId;
campaignCriterionPeak.criterion = peak;

// Create operations to add the new schedules.
CampaignCriterionOperation operationEarly = new CampaignCriterionOperation();
operationEarly.operand = campaignCriterionEarly;
operationEarly.@operator = Operator.ADD;
operations.Add(operationEarly);

CampaignCriterionOperation operationPeak = new CampaignCriterionOperation();
operationPeak.operand = campaignCriterionPeak;
operationPeak.@operator = Operator.ADD;
operations.Add(operationPeak);

campaignCriterionService.mutate(operations.ToArray());

Python

# Create operations to remove existing ad schedules for Monday. Ad schedules
# can't overlap.
operations = [{
    'operator': 'REMOVE',
    'operand': {
        'campaignId': campaign_id,
        'criterion': {
            'id': criteria_id
        }
    }
} for criteria_id in existing_criteria_ids]

# Create a schedule for 8:00 A.M. to 12:00 P.M. (noon) with no change to bids.
operations.append({
    'operator': 'ADD',
    'operand': {
        'campaignId': campaign_id,
        'criterion': {
            'xsi_type': 'AdSchedule',
            'dayOfWeek': 'MONDAY',
            'startHour': 8,
            'startMinute': 'ZERO',
            'endHour': 12,
            'endMinute': 'ZERO'
        },
        # Run at normal bid rates.
        'bidModifier': 1.0
    }
})

# Create a schedule for 12:00 P.M. (noon) to 2 P.M. with bids doubled.
operations.append({
    'operator': 'ADD',
    'operand': {
        'campaignId': campaign_id,
        'criterion': {
            'xsi_type': 'AdSchedule',
            'dayOfWeek': 'MONDAY',
            'startHour': 12,
            'startMinute': 'ZERO',
            'endHour': 14,
            'endMinute': 'ZERO'
        },
        # Double the bid.
        'bidModifier': 2.0
    }
})

campaign_criterion_service.mutate(operations)

PHP

$operations = [];

// Create operations to remove any existing ad schedules for Monday. Ad
// schedules cannot overlap.
foreach ($existingCriteriaIds as $existingCriterionId) {
    $campaignCriterion = new CampaignCriterion();
    $campaignCriterion->setCampaignId($campaignId);
    $adSchedule = new AdSchedule();
    $adSchedule->setId($existingCriterionId);
    $campaignCriterion->setCriterion($adSchedule);

    $removeOperation = new CampaignCriterionOperation();
    $removeOperation->setOperand($campaignCriterion);
    $removeOperation->setOperator(Operator::REMOVE);

    $operations[] = $removeOperation;
}

// Create a schedule for 8:00 AM to 12:00 PM (noon) with no change to bids.
$early = new AdSchedule();
$early->setDayOfWeek(DayOfWeek::MONDAY);
$early->setStartHour(8);
$early->setStartMinute(MinuteOfHour::ZERO);
$early->setEndHour(12);
$early->setEndMinute(MinuteOfHour::ZERO);

$campaignCriterionEarly = new CampaignCriterion();
// Run at normal bid rates.
$campaignCriterionEarly->setBidModifier(1.0);
$campaignCriterionEarly->setCampaignId($campaignId);
$campaignCriterionEarly->setCriterion($early);

// Create a schedule for 12:00 PM (noon) to 2:00 PM with bids doubled.
$peak = new AdSchedule();
$peak->setDayOfWeek(DayOfWeek::MONDAY);
$peak->setStartHour(12);
$peak->setStartMinute(MinuteOfHour::ZERO);
$peak->setEndHour(14);
$peak->setEndMinute(MinuteOfHour::ZERO);

$campaignCriterionPeak = new CampaignCriterion();
// Double the bid.
$campaignCriterionPeak->setBidModifier(2.0);
$campaignCriterionPeak->setCampaignId($campaignId);
$campaignCriterionPeak->setCriterion($peak);

// Create operations to add the new schedules.
$operationEarly = new CampaignCriterionOperation();
$operationEarly->setOperand($campaignCriterionEarly);
$operationEarly->setOperator(Operator::ADD);
$operations[] = $operationEarly;

$operationPeak = new CampaignCriterionOperation();
$operationPeak->setOperand($campaignCriterionPeak);
$operationPeak->setOperator(Operator::ADD);
$operations[] = $operationPeak;

$campaignCriterionService->mutate($operations);

Perl

my @operations = ();

# Create operations to remove any existing ad schedules for Monday. Ad
# schedules cannot overlap.
for my $existing_criterion_id (@{$existing_criterion_ids}) {
  my $campaign_criterion =
    Google::Ads::AdWords::v201802::CampaignCriterion->new({
      campaignId => $campaign_id,
      criterion  => Google::Ads::AdWords::v201802::AdSchedule->new({
          id => $existing_criterion_id
        })});

  my $remove_operation =
    Google::Ads::AdWords::v201802::CampaignCriterionOperation->new({
      operand  => $campaign_criterion,
      operator => 'REMOVE'
    });

  push @operations, $remove_operation;
}

# Create a schedule for 8:00 AM to 12:00 PM (noon) with no change to bids.
my $early = Google::Ads::AdWords::v201802::AdSchedule->new({
  dayOfWeek   => 'MONDAY',
  startHour   => '8',
  startMinute => 'ZERO',
  endHour     => '12',
  endMinute   => 'ZERO'
});

my $campaign_criterion_early =
  Google::Ads::AdWords::v201802::CampaignCriterion->new({
    campaignId => $campaign_id,
    criterion  => $early,
    # Run at normal bid rates
    bidModifier => '1.0'
  });

# Create a schedule for 12:00 PM (noon) to 2:00 PM with bids doubled.
my $peak = Google::Ads::AdWords::v201802::AdSchedule->new({
  dayOfWeek   => 'MONDAY',
  startHour   => '12',
  startMinute => 'ZERO',
  endHour     => '14',
  endMinute   => 'ZERO'
});

my $campaign_criterion_peak =
  Google::Ads::AdWords::v201802::CampaignCriterion->new({
    campaignId => $campaign_id,
    criterion  => $peak,
    # Double the bid.
    bidModifier => '2.0'
  });

# Create operations to add the new schedules.
my $operation_early =
  Google::Ads::AdWords::v201802::CampaignCriterionOperation->new({
    operand  => $campaign_criterion_early,
    operator => 'ADD'
  });
push @operations, $operation_early;

my $operation_peak =
  Google::Ads::AdWords::v201802::CampaignCriterionOperation->new({
    operand  => $campaign_criterion_peak,
    operator => 'ADD'
  });
push @operations, $operation_peak;

$client->CampaignCriterionService()->mutate({operations => \@operations});

Ruby

operations = []

# Create operations to remove any existing ad schedules for Monday. Ad
# schedules cannot overlap.
existing_criteria_ids.each do |existing_criterion_id|
  operations << {
    :operator => 'REMOVE',
    :operand => {
      :campaign_id => campaign_id,
      :criterion => {
        :id => existing_criterion_id
      }
    }
  }
end

# Create a schedule for 8:00 AM to 12:00 PM (noon) with no change to bids.
early = {
  :xsi_type => 'AdSchedule',
  :day_of_week => 'MONDAY',
  :start_hour => 8,
  :start_minute => 'ZERO',
  :end_hour => 12,
  :end_minute => 'ZERO'
}

campaign_criterion_early = {
  :bid_modifier => 1.0,
  :campaign_id => campaign_id,
  :criterion => early
}

operations << {
  :operator => 'ADD',
  :operand => campaign_criterion_early
}

# Create a schedule from 12:00 PM (noon) to 2:00 PM with bids doubled.
peak = {
  :xsi_type => 'AdSchedule',
  :day_of_week => 'MONDAY',
  :start_hour => 12,
  :start_minute => 'ZERO',
  :end_hour => 14,
  :end_minute => 'ZERO'
}

campaign_criterion_peak = {
  # Double the bid.
  :bid_modifier => 2.0,
  :campaign_id => campaign_id,
  :criterion => peak
}

operations << {
  :operator => 'ADD',
  :operand => campaign_criterion_peak
}

campaign_criterion_srv.mutate(operations)

VB.NET

Dim operations As New List(Of CampaignCriterionOperation)()

' Create operations to remove any existing ad schedules for Monday. Ad schedules cannot
' overlap.
For Each existingCriterionId As Long In existingCriteriaIds
  Dim campaignCriterion As New CampaignCriterion()
  campaignCriterion.campaignId = campaignId
  Dim adSchedule As New AdSchedule()
  adSchedule.id = existingCriterionId
  campaignCriterion.criterion = adSchedule

  Dim removeOperation As New CampaignCriterionOperation()
  removeOperation.operand = campaignCriterion
  removeOperation.operator = [Operator].REMOVE

  operations.Add(removeOperation)
Next

' Create a schedule for 800 AM to 1200 PM (noon) with no change to bids.
Dim early As New AdSchedule()
early.dayOfWeek = DayOfWeek.MONDAY
early.startHour = 8
early.startMinute = MinuteOfHour.ZERO
early.endHour = 12
early.endMinute = MinuteOfHour.ZERO

Dim campaignCriterionEarly As New CampaignCriterion()
' Run at normal bid rates.
campaignCriterionEarly.bidModifier = 1.0
campaignCriterionEarly.campaignId = campaignId
campaignCriterionEarly.criterion = early

' Create a schedule for 1200 PM (noon) to 200 PM with bids doubled.
Dim peak As New AdSchedule()
peak.dayOfWeek = DayOfWeek.MONDAY
peak.startHour = 12
peak.startMinute = MinuteOfHour.ZERO
peak.endHour = 14
peak.endMinute = MinuteOfHour.ZERO

Dim campaignCriterionPeak As New CampaignCriterion()
' Double the bid.
campaignCriterionPeak.bidModifier = 2.0
campaignCriterionPeak.campaignId = campaignId
campaignCriterionPeak.criterion = peak

' Create operations to add the New schedules.
Dim operationEarly As New CampaignCriterionOperation()
operationEarly.operand = campaignCriterionEarly
operationEarly.operator = [Operator].ADD
operations.Add(operationEarly)

Dim operationPeak As New CampaignCriterionOperation()
operationPeak.operand = campaignCriterionPeak
operationPeak.operator = [Operator].ADD
operations.Add(operationPeak)

campaignCriterionService.mutate(operations.ToArray())

Para parar a exibição de anúncios durante períodos específicos, remova o critério AdSchedule usando o id dele e o id da campanha.

Java

List<CampaignCriterionOperation> removeOperations = new ArrayList<>();

for (Long criterionId : criteriaIds) {
  // Remove the schedule with the specified criterion ID.
  AdSchedule scheduleToRemove = new AdSchedule();
  scheduleToRemove.setId(criterionId);

  CampaignCriterion campaignCriterion = new CampaignCriterion();

  campaignCriterion.setCampaignId(campaignId);
  campaignCriterion.setCriterion(scheduleToRemove);

  CampaignCriterionOperation operation = new CampaignCriterionOperation();
  operation.setOperand(campaignCriterion);
  operation.setOperator(Operator.REMOVE);
  removeOperations.add(operation);
}

campaignCriterionService.mutate(
    removeOperations.toArray(new CampaignCriterionOperation[removeOperations.size()]));

CSharp

List<CampaignCriterionOperation> removeOperations = new List<CampaignCriterionOperation>();

foreach (long criterionId in criteriaIds) {
  // Remove the schedule with the specified criterion ID.
  AdSchedule scheduleToRemove = new AdSchedule();
  scheduleToRemove.id = criterionId;

  CampaignCriterion campaignCriterion = new CampaignCriterion();

  campaignCriterion.campaignId = campaignId;
  campaignCriterion.criterion = scheduleToRemove;

  CampaignCriterionOperation operation = new CampaignCriterionOperation();
  operation.operand = campaignCriterion;
  operation.@operator = Operator.REMOVE;
  removeOperations.Add(operation);
}

campaignCriterionService.mutate(removeOperations.ToArray());

Python

operations = [{
    'operator': 'REMOVE',
    'operand': {
        'campaignId': campaign_id,
        'criterion': {
            'id': criteria_id
        }
    }
} for criteria_id in criteria_ids]

if operations:
  campaign_criterion_service.mutate(operations)

PHP

$removeOperations = [];

foreach ($criteriaIds as $criterionId) {
    // Remove the schedule with the specified criterion ID.
    $scheduleToRemove = new AdSchedule();
    $scheduleToRemove->setId($criterionId);

    $campaignCriterion = new CampaignCriterion();

    $campaignCriterion->setCampaignId($campaignId);
    $campaignCriterion->setCriterion($scheduleToRemove);

    $operation = new CampaignCriterionOperation();
    $operation->setOperand($campaignCriterion);
    $operation->setOperator(Operator::REMOVE);
    $removeOperations[] = $operation;
}

if (!empty($removeOperations)) {
    $campaignCriterionService->mutate($removeOperations);
}

Perl

my @remove_operations = ();

foreach my $criterion_id (@{$criteria_ids}) {
  # Remove the schedule with the specified criterion ID.
  my $schedule_to_remove = Google::Ads::AdWords::v201802::AdSchedule->new({
    id => $criterion_id
  });

  my $campaign_criterion =
    Google::Ads::AdWords::v201802::CampaignCriterion->new({
      campaignId => $campaign_id,
      criterion  => $schedule_to_remove
    });

  my $operation =
    Google::Ads::AdWords::v201802::CampaignCriterionOperation->new({
      operand  => $campaign_criterion,
      operator => 'REMOVE'
    });
  push @remove_operations, $operation;
}

$client->CampaignCriterionService()
  ->mutate({operations => \@remove_operations});

Ruby

operations = criteria_ids.map do |criterion_id|
  {
    :operator => 'REMOVE',
    :operand => {
      :campaign_id => campaign_id,
      :criterion => {
        :id => criterion_id
      }
    }
  }
end

campaign_criterion_srv.mutate(operations) unless operations.empty?

VB.NET

Dim removeOperations As New List(Of CampaignCriterionOperation)()

For Each criterionId As Long In criteriaIds
  ' Remove the schedule with the specified criterion ID.
  Dim scheduleToRemove As New AdSchedule()
  scheduleToRemove.id = criterionId

  Dim campaignCriterion As New CampaignCriterion()

  campaignCriterion.campaignId = campaignId
  campaignCriterion.criterion = scheduleToRemove

  Dim operation As New CampaignCriterionOperation()
  operation.operand = campaignCriterion
  operation.operator = [Operator].REMOVE
  removeOperations.Add(operation)
Next

campaignCriterionService.mutate(removeOperations.ToArray())

Este exemplo mostra como alterar o horário de exibição dos anúncios. Primeiro você precisa remover o AdSchedule existente e depois adicionar o novo.

Java

List<CampaignCriterionOperation> operations = new ArrayList<>();

// Create an operation that will remove the existing schedule for Friday.
AdSchedule existingScheduleForFriday = new AdSchedule();
existingScheduleForFriday.setId(criterionIdForFriday);

CampaignCriterion existingCampaignCriterionForFriday = new CampaignCriterion();
existingCampaignCriterionForFriday.setCampaignId(campaignId);
existingCampaignCriterionForFriday.setCriterion(existingScheduleForFriday);

CampaignCriterionOperation removeOperation = new CampaignCriterionOperation();
removeOperation.setOperand(existingCampaignCriterionForFriday);
removeOperation.setOperator(Operator.REMOVE);
operations.add(removeOperation);

// Create an operation to add the new schedule for Friday.
AdSchedule newScheduleForFriday = new AdSchedule();
newScheduleForFriday.setDayOfWeek(DayOfWeek.FRIDAY);
// Start at 3:00 pm...
newScheduleForFriday.setStartHour(15);
newScheduleForFriday.setStartMinute(MinuteOfHour.ZERO);
// ... and end at 7:45 pm
newScheduleForFriday.setEndHour(19);
newScheduleForFriday.setEndMinute(MinuteOfHour.FORTY_FIVE);

CampaignCriterion newCampaignCriterionForFriday = new CampaignCriterion();
newCampaignCriterionForFriday.setCampaignId(campaignId);
newCampaignCriterionForFriday.setCriterion(newScheduleForFriday);
// Run at normal bid rates
newCampaignCriterionForFriday.setBidModifier(1.0);

CampaignCriterionOperation addOperation = new CampaignCriterionOperation();
addOperation.setOperand(newCampaignCriterionForFriday);
addOperation.setOperator(Operator.ADD);
operations.add(addOperation);

campaignCriterionService.mutate(
    operations.toArray(new CampaignCriterionOperation[operations.size()]));

CSharp

List<CampaignCriterionOperation> operations = new List<CampaignCriterionOperation>();

// Create an operation that will remove the existing schedule for Friday.
AdSchedule existingScheduleForFriday = new AdSchedule();
existingScheduleForFriday.id = criterionIdForFriday;

CampaignCriterion existingCampaignCriterionForFriday = new CampaignCriterion();
existingCampaignCriterionForFriday.campaignId = campaignId;
existingCampaignCriterionForFriday.criterion = existingScheduleForFriday;

CampaignCriterionOperation removeOperation = new CampaignCriterionOperation();
removeOperation.operand = existingCampaignCriterionForFriday;
removeOperation.@operator = Operator.REMOVE;
operations.Add(removeOperation);

// Create an operation to add the new schedule for Friday.
AdSchedule newScheduleForFriday = new AdSchedule();
newScheduleForFriday.dayOfWeek = DayOfWeek.FRIDAY;
// Start at 3:00 pm...
newScheduleForFriday.startHour = 15;
newScheduleForFriday.startMinute = MinuteOfHour.ZERO;
// ... and end at 7:45 pm
newScheduleForFriday.endHour = 19;
newScheduleForFriday.endMinute = MinuteOfHour.FORTY_FIVE;

CampaignCriterion newCampaignCriterionForFriday = new CampaignCriterion();
newCampaignCriterionForFriday.campaignId = campaignId;
newCampaignCriterionForFriday.criterion = newScheduleForFriday;
// Run at normal bid rates
newCampaignCriterionForFriday.bidModifier = 1.0;

CampaignCriterionOperation addOperation = new CampaignCriterionOperation();
addOperation.operand = newCampaignCriterionForFriday;
addOperation.@operator = Operator.ADD;
operations.Add(addOperation);

campaignCriterionService.mutate(operations.ToArray());

Python

operations = [
    # Create an operation that will remove the existing schedule for Friday.
    {
        'operator': 'REMOVE',
        'operand': {
            'campaignId': campaign_id,
            'criterion': {
                'id': friday_criterion_id
            }
        }
    },
    # Create an operation to add the new schedule for Friday.
    {
        'operator': 'ADD',
        'operand': {
            'campaignId': campaign_id,
            'criterion': {
                'xsi_type': 'AdSchedule',
                'dayOfWeek': 'FRIDAY',
                'startHour': 15,
                'startMinute': 'ZERO',
                'endHour': 19,
                'endMinute': 'FORTY_FIVE'
            },
            # Run at normal bid rates.
            'bidModifier': 1.0
        }
    }
]

campaign_criterion_service.mutate(operations)

PHP

$operations = [];

// Create an operation that will remove the existing schedule for Friday.
$existingScheduleForFriday = new AdSchedule();
$existingScheduleForFriday->setId($criterionIdForFriday);

$existingCampaignCriterionForFriday = new CampaignCriterion();
$existingCampaignCriterionForFriday->setCampaignId($campaignId);
$existingCampaignCriterionForFriday->setCriterion(
    $existingScheduleForFriday
);

$removeOperation = new CampaignCriterionOperation();
$removeOperation->setOperand($existingCampaignCriterionForFriday);
$removeOperation->setOperator(Operator::REMOVE);
$operations[] = $removeOperation;

// Create an operation to add the new schedule for Friday.
$newScheduleForFriday = new AdSchedule();
$newScheduleForFriday->setDayOfWeek(DayOfWeek::FRIDAY);
// Start at 3:00 pm...
$newScheduleForFriday->setStartHour(15);
$newScheduleForFriday->setStartMinute(MinuteOfHour::ZERO);
// ... and end at 7:45 pm
$newScheduleForFriday->setEndHour(19);
$newScheduleForFriday->setEndMinute(MinuteOfHour::FORTY_FIVE);

$newCampaignCriterionForFriday = new CampaignCriterion();
$newCampaignCriterionForFriday->setCampaignId($campaignId);
$newCampaignCriterionForFriday->setCriterion($newScheduleForFriday);
// Run at normal bid rates
$newCampaignCriterionForFriday->setBidModifier(1.0);

$addOperation = new CampaignCriterionOperation();
$addOperation->setOperand($newCampaignCriterionForFriday);
$addOperation->setOperator(Operator::ADD);
$operations[] = $addOperation;

$campaignCriterionService->mutate($operations);

Perl

my @operations = ();

# Create an operation that will remove the existing schedule for Friday.
my $existing_campaign_criterion_for_friday =
  Google::Ads::AdWords::v201802::CampaignCriterion->new({
    campaignId => $campaign_id,
    criterion  => Google::Ads::AdWords::v201802::AdSchedule->new({
        id => $criterion_id_for_friday
      })});

my $remove_operation =
  Google::Ads::AdWords::v201802::CampaignCriterionOperation->new({
    operand  => $existing_campaign_criterion_for_friday,
    operator => 'REMOVE'
  });

push @operations, $remove_operation;

# Create an operation to add the new schedule for Friday.
my $new_schedule_for_friday = Google::Ads::AdWords::v201802::AdSchedule->new({
  dayOfWeek => 'FRIDAY',
  # Start at 3:00 pm...
  startHour   => '15',
  startMinute => 'ZERO',
  # ... and end at 7:45 pm
  endHour   => '19',
  endMinute => 'FORTY_FIVE'
});

my $new_campaign_criterion_for_friday =
  Google::Ads::AdWords::v201802::CampaignCriterion->new({
    campaignId => $campaign_id,
    criterion  => $new_schedule_for_friday,
    # Run at normal bid rates
    bidModifier => '1.0'
  });

my $add_operation =
  Google::Ads::AdWords::v201802::CampaignCriterionOperation->new({
    operand  => $new_campaign_criterion_for_friday,
    operator => 'ADD'
  });
push @operations, $add_operation;

$client->CampaignCriterionService()->mutate({operations => \@operations});

Ruby

operations = []

# Create an operation that will remove the existing schedule for Friday.
operations << {
  :operator => 'REMOVE',
  :operand => {
    :campaign_id => campaign_id,
    :criterion => {
      :id => criterion_id_for_friday
    }
  }
}

# Create an operation to add the new schedule for Friday.
operations << {
  :operator => 'ADD',
  :operand => {
    :campaign_id => campaign_id,
    # Run at normal bid rades.
    :bid_modifier => 1.0,
    :criterion => {
      :xsi_type => 'AdSchedule',
      :day_of_week => 'FRIDAY',
      # Start at 3:00 PM...
      :start_hour => 15,
      :start_minute => 'ZERO',
      # ...and end at 7:45 PM.
      :end_hour => 19,
      :end_minute => 'FORTY_FIVE'
    }
  }
}

campaign_criterion_srv.mutate(operations)

VB.NET

Dim operations As New List(Of CampaignCriterionOperation)()

' Create an operation that will remove the existing schedule for Friday.
Dim existingScheduleForFriday As New AdSchedule()
existingScheduleForFriday.id = criterionIdForFriday

Dim existingCampaignCriterionForFriday As New CampaignCriterion()
existingCampaignCriterionForFriday.campaignId = campaignId
existingCampaignCriterionForFriday.criterion = existingScheduleForFriday

Dim removeOperation As New CampaignCriterionOperation()
removeOperation.operand = existingCampaignCriterionForFriday
removeOperation.operator = [Operator].REMOVE
operations.Add(removeOperation)

' Create an operation to add the New schedule for Friday.
Dim newScheduleForFriday As New AdSchedule()
newScheduleForFriday.dayOfWeek = DayOfWeek.FRIDAY
' Start at 3:00 pm...
newScheduleForFriday.startHour = 15
newScheduleForFriday.startMinute = MinuteOfHour.ZERO
' ... And end at 7:45 pm
newScheduleForFriday.endHour = 19
newScheduleForFriday.endMinute = MinuteOfHour.FORTY_FIVE

Dim newCampaignCriterionForFriday As New CampaignCriterion()
newCampaignCriterionForFriday.campaignId = campaignId
newCampaignCriterionForFriday.criterion = newScheduleForFriday
' Run at normal bid rates
newCampaignCriterionForFriday.bidModifier = 1.0

Dim addOperation As New CampaignCriterionOperation()
addOperation.operand = newCampaignCriterionForFriday
addOperation.operator = [Operator].ADD
operations.Add(addOperation)

campaignCriterionService.mutate(operations.ToArray())

Confira estes exemplos de código para saber como usar o CampaignCriterionService com o objetivo de adicionar uma segmentação a uma campanha existente:

Avaliação do desempenho do anúncio

Você configurou uma campanha, um grupo de anúncios, um anúncio de texto e várias extensões de anúncios. Agora, você quer saber o desempenho da campanha, dos anúncios e das extensões. É nesta etapa que entram os relatórios.

É possível analisar o desempenho da sua campanha de diferentes perspectivas para responder a perguntas importantes. Amplie os casos de uso abaixo para ver os relatórios e campos relevantes, além de um exemplo de solicitação AWQL de relatório.

As perguntas acima se concentram em alguns casos de uso e recursos comuns. Para mais opções, consulte a lista completa de tipos de relatório.

Próximas etapas

Depois de analisar seus relatórios:

Enviar comentários sobre…

Precisa de ajuda? Acesse nossa página de suporte.