تنظیمات هدف گیری

از تنظیمات هدف‌گیری در گروه‌های تبلیغاتی یا کمپین‌های خود استفاده کنید تا مشخص کنید که آیا تبلیغات خود را محدود کنید تا فقط به بخش‌های خاصی از مخاطبان یا محتوای خاصی که انتخاب کرده‌اید نمایش داده شود.

تنظیمات هدف‌گیری را تنظیم کنید

شما می‌توانید با تنظیم فیلد TargetingSetting با آرایه‌ای از target_restrictions ، جزئیاتی در مورد نحوه استفاده از انواع معیارهای مختلف خود برای هدف‌گیری تنظیم کنید. هر TargetRestriction به شما امکان می‌دهد کنترل کنید که آیا یک نوع معیار از گزینه bid_only استفاده می‌کند یا خیر.

وقتی bid_only روی true تنظیم می‌کنید، تنظیمات هدف‌گیری روی «مشاهده» تنظیم می‌شود و این معیارها برای محدود کردن ترافیک استفاده نمی‌شوند، اما به شما امکان می‌دهند برای کاربران مختلف در لیست‌های خود، پیشنهادهای متفاوتی ارائه دهید. تنظیم bid_only روی false تنظیمات هدف‌گیری را روی «هدف‌گیری» تنظیم می‌کند و معیارها را قادر می‌سازد تا ترافیک گروه‌های تبلیغاتی را فقط به کاربران موجود در لیست هدف محدود کنند.

تفاوت‌های کلیدی در جدول زیر خلاصه شده‌اند:

تنظیم bid_only تأثیر بر دسترسی تأثیر پیشنهاد قیمت
هدف‌گیری false فقط به معیارهای انتخاب شده محدود می‌شود می‌تواند پیشنهادهای ویژه‌ای را بر اساس معیارها تعیین کند
مشاهده true محدود نمی‌شود ؛ تبلیغات طبق معمول نمایش داده می‌شوند امکان تنظیم پیشنهاد بر اساس معیارها را فراهم می‌کند

سناریوهای عملی

در اینجا مثال‌های کوتاهی از زمان استفاده از حالت مشاهده در مقابل حالت هدف‌گیری آورده شده است:

مشاهده
اگر یک کمپین جستجو اجرا می‌کنید و می‌خواهید بدانید که یک مخاطب خاص (مثلاً "طرفداران ورزش") در مقایسه با عموم مردم چقدر خوب تبدیل می‌شود، بدون اینکه تبلیغات خود را فقط به آن مخاطب محدود کنید. می‌توانید "طرفداران ورزش" را به عنوان معیار مخاطب با bid_only = true (Observation) اضافه کنید و یک تنظیم پیشنهاد +10٪ اعمال کنید. این به شما امکان می‌دهد داده‌های عملکرد را برای آن مخاطب جمع‌آوری کنید و در صورت عملکرد خوب، بدون از دست دادن ترافیک کاربران خارج از آن مخاطب، برای آنها رقابتی‌تر پیشنهاد دهید.
هدف‌گیری
اگر یک کمپین نمایشی برای بازاریابی مجدد کاربرانی که قبلاً از وب‌سایت شما بازدید کرده‌اند اما تبدیل به مشتری نشده‌اند، اجرا می‌کنید. شما فقط می‌خواهید کاربران موجود در لیست کاربران "رهاکنندگان سبد خرید" شما این تبلیغات خاص را ببینند. در این حالت، لیست "رهاکنندگان سبد خرید" را به عنوان معیار UserList با bid_only = false (هدف‌گیری) اضافه می‌کنید. این تضمین می‌کند که بودجه گروه تبلیغاتی شما فقط برای دسترسی به این بخش از مخاطبان با هدف بالا هزینه می‌شود.

بهترین شیوه‌ها

به طور پیش‌فرض، bid_only روی false تنظیم شده است، به این معنی که تنظیم هدف‌گیری روی "Targeting" تنظیم می‌شود. اگر بخش‌های مخاطب را به یک کمپین جستجو یا خرید اضافه می‌کنید، تغییر تنظیم هدف‌گیری bid_only به true را در نظر بگیرید تا آن را روی "Observation" تنظیم کنید.

اگر در حال تنظیم یک کمپین تکراری برای بخش‌های مخاطبان برای تبلیغات جستجو هستید، هدف‌گیری bid_only را روی false تنظیم کنید.

محدودیت‌ها

اگر targeting_setting روی کمپین والد تنظیم شده باشد، نمی‌توانید targeting_setting روی یک AdGroup اضافه یا به‌روزرسانی کنید. اگر targeting_setting روی Campaign والد تنظیم شده باشد، ابتدا باید targeting_setting روی Campaign والد حذف کنید. به همین ترتیب، ابتدا باید targeting_setting روی AdGroup حذف کنید تا بتوانید آن را روی Campaign تنظیم کنید.

بازیابی تنظیمات هدف‌گیری

برای تأیید اینکه هدف‌گیری شما مطابق میل شما تنظیم شده است، با درخواست فیلد ad_group.targeting_setting.target_restrictions از منبع ad_group در یک عبارت جستجو، targeting_setting در گروه‌های تبلیغاتی یا کمپین‌ها بررسی کنید.

مثال

این مثال، targeting_setting در یک گروه تبلیغاتی به‌روزرسانی می‌کند، به طوری که bid_only برای نمونه‌های TargetRestriction با targeting_dimension برابر با AUDIENCE ، true را داشته باشد، که به شما امکان می‌دهد بدون محدود کردن دسترسی، پیشنهادات خاصی را برای کاربران در بخش مخاطبان تعیین کنید.

ابتدا، تمام ad_group.targeting_setting.target_restrictions را از گروه تبلیغاتی با شناسه ارائه شده بازیابی کنید.

جاوا

String searchQuery =
    "SELECT ad_group.id, ad_group.name, ad_group.targeting_setting.target_restrictions "
        + "FROM ad_group "
        + "WHERE ad_group.id = "
        + adGroupId;
      

سی شارپ

string query = $@"
    SELECT ad_group.id, ad_group.name, ad_group.targeting_setting.target_restrictions
    FROM ad_group
    WHERE ad_group.id = {adGroupId}";
      

پی اچ پی

$query = "SELECT ad_group.id, ad_group.name, " .
    "ad_group.targeting_setting.target_restrictions " .
    "FROM ad_group " .
    "WHERE ad_group.id = $adGroupId";
      

پایتون

query: str = f"""
    SELECT
      ad_group.id,
      ad_group.name,
      ad_group.targeting_setting.target_restrictions
    FROM ad_group
    WHERE ad_group.id = {ad_group_id}"""
      

روبی

query = <<~QUERY
  SELECT ad_group.id, ad_group.name,
         ad_group.targeting_setting.target_restrictions
  FROM ad_group
  WHERE ad_group.id = #{ad_group_id}
QUERY
      

پرل

my $query =
  "SELECT ad_group.id, ad_group.name, " .
  "ad_group.targeting_setting.target_restrictions FROM ad_group " .
  "WHERE ad_group.id = $ad_group_id";
      

در مرحله بعد، محدودیت‌های هدف را مرور کرده و اشیاء TargetingSetting بازسازی کنید. اگر کد با یک TargetRestriction با targeting_dimension برابر با AUDIENCE و مقدار bid_only برابر با false مواجه شود، فیلد bid_only شیء TargetRestriction را به true (یا "Observation") به‌روزرسانی می‌کند و آن را به شیء TargetingSetting ما اضافه می‌کند.

در غیر این صورت، شیء TargetRestriction را همانطور که از سرور برگردانده شده است به TargetingSetting اضافه کنید. توجه به این نکته ضروری است که باید کل شیء TargetingSetting بازسازی کرده و به Google Ads ارسال کنید. گوگل فرض می‌کند که هر target_restrictions که در TargetingSetting وجود ندارد، باید حذف شود.

جاوا

for (TargetRestriction targetRestriction : targetRestrictions) {
  TargetingDimension targetingDimension = targetRestriction.getTargetingDimension();
  boolean bidOnly = targetRestriction.getBidOnly();
  System.out.printf(
      "- Targeting restriction with targeting dimension '%s' and bid only set to '%b'.%n",
      targetingDimension, bidOnly);
  // Adds the target restriction to the TargetingSetting object as is if the targeting
  // dimension has a value other than AUDIENCE because those should not change.
  if (!targetingDimension.equals(TargetingDimension.AUDIENCE)) {
    targetingSettingBuilder.addTargetRestrictions(targetRestriction);
  } else if (!bidOnly) {
    shouldUpdateTargetingSetting = true;
    // Adds an AUDIENCE target restriction with bid_only set to true to the targeting
    // setting object. This has the effect of setting the AUDIENCE target restriction to
    // "Observation". For more details about the targeting setting, visit
    // https://support.google.com/google-ads/answer/7365594.
    targetingSettingBuilder.addTargetRestrictions(
        TargetRestriction.newBuilder()
            .setTargetingDimensionValue(TargetingDimension.AUDIENCE_VALUE)
            .setBidOnly(true));
  }
}
      

سی شارپ

foreach (TargetRestriction targetRestriction in targetRestrictions)
{
    TargetingDimension targetingDimension =
        targetRestriction.TargetingDimension;
    bool bidOnly = targetRestriction.BidOnly;

    Console.WriteLine("\tTargeting restriction with targeting dimension " +
        $"'{targetingDimension}' and bid only set to '{bidOnly}'.");

    // Add the target restriction to the TargetingSetting object as is if the
    // targeting dimension has a value other than AUDIENCE because those should
    // not change.
    if (targetingDimension != TargetingDimension.Audience)
    {
        targetingSetting.TargetRestrictions.Add(targetRestriction);
    }
    else if (!bidOnly)
    {
        shouldUpdateTargetingSetting = true;

        // Add an AUDIENCE target restriction with bid_only set to true to the
        // targeting setting object. This has the effect of setting the AUDIENCE
        // target restriction to "Observation". For more details about the
        // targeting setting, visit
        // https://support.google.com/google-ads/answer/7365594.
        targetingSetting.TargetRestrictions.Add(new TargetRestriction
        {
            TargetingDimension = TargetingDimension.Audience,
            BidOnly = true
        });
    }
}
      

پی اچ پی

foreach (
    $adGroup->getTargetingSetting()->getTargetRestrictions() as $targetRestriction
) {
    // Prints the results.
    $targetingDimension = $targetRestriction->getTargetingDimension();
    $bidOnly = $targetRestriction->getBidOnly();
    printf(
        "- Targeting restriction with targeting dimension '%s' and bid only set to " .
        "'%s'.%s",
        TargetingDimension::name($targetingDimension),
        $bidOnly ? 'true' : 'false',
        PHP_EOL
    );

    // Adds the target restriction to the TargetingSetting object as is if the targeting
    // dimension has a value other than AUDIENCE because those should not change.
    if ($targetingDimension !== TargetingDimension::AUDIENCE) {
        $targetRestrictions[] = $targetRestriction;
    } elseif (!$bidOnly) {
        $shouldUpdateTargetingSetting = true;

        // Adds an AUDIENCE target restriction with bid_only set to true to the
        // targeting setting object. This has the effect of setting the AUDIENCE
        // target restriction to "Observation".
        // For more details about the targeting setting, visit
        // https://support.google.com/google-ads/answer/7365594.
        $targetRestrictions[] = new TargetRestriction([
            'targeting_dimension' => TargetingDimension::AUDIENCE,
            'bid_only' => true
        ]);
    }
}
      

پایتون

target_restriction: TargetRestriction
for target_restriction in target_restrictions:
    targeting_dimension: TargetingDimensionEnum.TargetingDimension = (
        target_restriction.targeting_dimension
    )
    bid_only: bool = target_restriction.bid_only

    print(
        "\tTargeting restriction with targeting dimension "
        f"'{targeting_dimension.name}' "
        f"and bid only set to '{bid_only}'."
    )

    # Add the target restriction to the TargetingSetting object as
    # is if the targeting dimension has a value other than audience
    # because those should not change.
    if targeting_dimension != targeting_dimension_enum.AUDIENCE:
        targeting_setting.target_restrictions.append(target_restriction)
    elif not bid_only:
        should_update_targeting_setting: bool = True

        # Add an audience target restriction with bid_only set to
        # true to the targeting setting object. This has the effect
        # of setting the audience target restriction to
        # "Observation". For more details about the targeting
        # setting, visit
        # https://support.google.com/google-ads/answer/7365594.
        new_target_restriction: TargetRestriction = (
            targeting_setting.target_restrictions.add()
        )
        new_target_restriction.targeting_dimension = (
            targeting_dimension_enum.AUDIENCE
        )
        new_target_restriction.bid_only = True
      

روبی

ad_group.targeting_setting.target_restrictions.each do |r|
  # Prints the results.
  targeting_dimension = r.targeting_dimension
  bid_only = r.bid_only
  puts "- Targeting restriction with targeting dimension " \
    "#{targeting_dimension} and bid only set to #{bid_only}."

  # Adds the target restriction to the TargetingSetting object as is if the
  # targeting dimension has a value other than AUDIENCE because those should
  # not change.
  if targeting_dimension != :AUDIENCE
    target_restrictions << r
  elsif !bid_only
    should_update_targeting_setting = true

    # Adds an AUDIENCE target restriction with bid_only set to true to the
    # targeting setting object. This has the effect of setting the AUDIENCE
    # target restriction to "Observation".
    # For more details about the targeting setting, visit
    # https://support.google.com/google-ads/answer/7365594.
    target_restrictions << client.resource.target_restriction do |tr|
      tr.targeting_dimension = :AUDIENCE
      tr.bid_only = true
    end
  end
end
      

پرل

foreach my $target_restriction (@target_restrictions) {
  my $targeting_dimension = $target_restriction->{targetingDimension};

  printf
    "\tTargeting restriction with targeting dimension '%s' and bid " .
    "only set to '%s'.\n",
    $targeting_dimension,
    $target_restriction->{bidOnly} ? "TRUE" : "FALSE";

  # Add the target restriction to the TargetingSetting object as is if the
  # targeting dimension has a value other than AUDIENCE because those
  # should not change.
  if ($targeting_dimension ne AUDIENCE) {
    $target_restriction->{bidOnly} =
      $target_restriction->{bidOnly} ? "true" : "false";
    push @{$targeting_setting->{targetRestrictions}}, $target_restriction;
  } elsif (!$target_restriction->{bidOnly}) {
    $should_update_target_setting = 1;

    # Add an AUDIENCE target restriction with bid_only set to true to the
    # targeting setting object. This has the effect of setting the
    # AUDIENCE target restriction to "Observation". For more details about
    # the targeting setting, visit
    # https://support.google.com/google-ads/answer/7365594.
    my $new_restriction =
      Google::Ads::GoogleAds::V22::Common::TargetRestriction->new({
        targetingDimension => AUDIENCE,
        bidOnly            => "true"
      });
    push @{$targeting_setting->{targetRestrictions}}, $new_restriction;
  }
}
      

Finally, if the code encounters a target restriction that requires updating, it updates the ad group with the new targeting settings.

جاوا

private void updateTargetingSetting(
    GoogleAdsClient googleAdsClient,
    long customerId,
    long adGroupId,
    TargetingSetting targetingSetting) {
  // Creates the ad group service client.
  try (AdGroupServiceClient adGroupServiceClient =
      googleAdsClient.getLatestVersion().createAdGroupServiceClient()) {
    // Creates an ad group object with the proper resource name and updated targeting setting.
    AdGroup adGroup =
        AdGroup.newBuilder()
            .setResourceName(ResourceNames.adGroup(customerId, adGroupId))
            .setTargetingSetting(targetingSetting)
            .build();
    // Constructs an operation that will update the ad group, using the FieldMasks utility to
    // derive the update mask. This mask tells the Google Ads API which attributes of the
    // ad group you want to change.
    AdGroupOperation operation =
        AdGroupOperation.newBuilder()
            .setUpdate(adGroup)
            .setUpdateMask(FieldMasks.allSetFieldsOf(adGroup))
            .build();
    // Sends the operation in a mutate request.
    MutateAdGroupsResponse response =
        adGroupServiceClient.mutateAdGroups(
            Long.toString(customerId), ImmutableList.of(operation));
    // Prints the resource name of the updated object.
    System.out.printf(
        "Updated targeting setting of ad group with resource name '%s'; set the AUDIENCE "
            + "target restriction to 'Observation'.%n",
        response.getResults(0).getResourceName());
  }
}
      

سی شارپ

private void UpdateTargetingSetting(GoogleAdsClient client, long customerId, long
    adGroupId, TargetingSetting targetingSetting)
{
    // Get the AdGroupService client.
    AdGroupServiceClient adGroupServiceClient =
        client.GetService(Services.V22.AdGroupService);

    // Create an ad group object with the updated targeting setting.
    AdGroup adGroup = new AdGroup
    {
        ResourceName = ResourceNames.AdGroup(customerId, adGroupId),
        TargetingSetting = targetingSetting
    };

    // Construct an operation that will update the ad group, using the FieldMasks utility
    // to derive the update mask. This mask tells the Google Ads API which attributes of the
    // ad group you want to change.
    AdGroupOperation operation = new AdGroupOperation
    {
        Update = adGroup,
        UpdateMask = FieldMasks.AllSetFieldsOf(adGroup)
    };

    // Send the operation in a mutate request.
    MutateAdGroupsResponse response =
        adGroupServiceClient.MutateAdGroups(customerId.ToString(), new[] { operation });
    // Print the resource name of the updated object.
    Console.WriteLine("Updated targeting setting of ad group with resource name " +
        $"'{response.Results.First().ResourceName}'; set the AUDIENCE target restriction " +
        "to 'Observation'.");
}
      

پی اچ پی

private static function updateTargetingSetting(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    int $adGroupId,
    TargetingSetting $targetingSetting
) {
    // Creates an ad group object with the proper resource name and updated targeting setting.
    $adGroup = new AdGroup([
        'resource_name' => ResourceNames::forAdGroup($customerId, $adGroupId),
        'targeting_setting' => $targetingSetting
    ]);

    // Constructs an operation that will update the ad group with the specified resource name,
    // using the FieldMasks utility to derive the update mask. This mask tells the Google Ads
    // API which attributes of the ad group you want to change.
    $adGroupOperation = new AdGroupOperation();
    $adGroupOperation->setUpdate($adGroup);
    $adGroupOperation->setUpdateMask(FieldMasks::allSetFieldsOf($adGroup));

    // Issues a mutate request to update the ad group.
    $adGroupServiceClient = $googleAdsClient->getAdGroupServiceClient();
    $response = $adGroupServiceClient->mutateAdGroups(
        MutateAdGroupsRequest::build($customerId, [$adGroupOperation])
    );

    // Prints the resource name of the updated ad group.
    printf(
        "Updated targeting setting of ad group with resource name '%s'; set the AUDIENCE " .
        "target restriction to 'Observation'.%s",
        $response->getResults()[0]->getResourceName(),
        PHP_EOL
    );
}
      

پایتون

def update_targeting_setting(
    client: GoogleAdsClient,
    customer_id: str,
    ad_group_id: str,
    targeting_setting: TargetingSetting,
) -> None:
    """Updates the given TargetingSetting of an ad group.

    Args:
        client: The Google Ads client.
        customer_id: The Google Ads customer ID.
        ad_group_id: The ad group ID for which to update the audience targeting
            restriction.
        targeting_setting: The updated targeting setting.
    """
    # Get the AdGroupService client.
    ad_group_service: AdGroupServiceClient = client.get_service(
        "AdGroupService"
    )

    # Construct an operation that will update the ad group.
    ad_group_operation: AdGroupOperation = client.get_type("AdGroupOperation")

    # Populate the ad group object with the updated targeting setting.
    ad_group: AdGroup = ad_group_operation.update
    ad_group.resource_name = ad_group_service.ad_group_path(
        customer_id, ad_group_id
    )
    ad_group.targeting_setting.target_restrictions.extend(
        targeting_setting.target_restrictions
    )
    # Use the field_mask utility to derive the update mask. This mask tells the
    # Google Ads API which attributes of the ad group you want to change.
    client.copy_from(
        ad_group_operation.update_mask,
        protobuf_helpers.field_mask(None, ad_group._pb),
    )

    # Send the operation in a mutate request and print the resource name of the
    # updated object.
    mutate_ad_groups_response: MutateAdGroupsResponse = (
        ad_group_service.mutate_ad_groups(
            customer_id=customer_id, operations=[ad_group_operation]
        )
    )
    print(
        "Updated targeting setting of ad group with resource name "
        f"'{mutate_ad_groups_response.results[0].resource_name}'; set the "
        "audience target restriction to 'Observation'."
    )
      

روبی

def update_targeting_setting(
  client,
  customer_id,
  ad_group_id,
  targeting_setting)
  # Constructs an operation that will update the ad group with the specified
  # resource name.
  ad_group_resource_name = client.path.ad_group(customer_id, ad_group_id)
  operation = client.operation.update_resource.ad_group(ad_group_resource_name) do |ag|
    ag.targeting_setting = targeting_setting
  end

  # Issues a mutate request to update the ad group.
  response = client.service.ad_group.mutate_ad_groups(
    customer_id: customer_id,
    operations: [operation],
  )

  # Prints the resource name of the updated ad group.
  puts "Updated targeting setting of ad group with resource name " \
    "#{response.results.first.resource_name}; set the AUDIENCE target " \
    "restriction to 'Observation'."
end
      

پرل

sub update_targeting_setting {
  my ($api_client, $customer_id, $ad_group_id, $targeting_setting) = @_;

  # Construct an ad group object with the updated targeting setting.
  my $ad_group = Google::Ads::GoogleAds::V22::Resources::AdGroup->new({
      resourceName =>
        Google::Ads::GoogleAds::V22::Utils::ResourceNames::ad_group(
        $customer_id, $ad_group_id
        ),
      targetingSetting => $targeting_setting
    });

  # Create an operation that will update the ad group, using the FieldMasks
  # utility to derive the update mask. This mask tells the Google Ads API which
  # attributes of the ad group you want to change.
  my $ad_group_operation =
    Google::Ads::GoogleAds::V22::Services::AdGroupService::AdGroupOperation->
    new({
      update     => $ad_group,
      updateMask => all_set_fields_of($ad_group)});

  # Send the operation in a mutate request and print the resource name of the
  # updated resource.
  my $ad_groups_response = $api_client->AdGroupService()->mutate({
      customerId => $customer_id,
      operations => [$ad_group_operation]});

  printf "Updated targeting setting of ad group with resourceName " .
    "'%s'; set the AUDIENCE target restriction to 'Observation'.\n",
    $ad_groups_response->{results}[0]{resourceName};
}
      

فرآیند تنظیم فیلد bid_only برای کمپین‌ها تقریباً یکسان است.

قدم بعدی چیست؟