ایجاد کنارگذاری داده‌ها

مستثنا کردن داده‌ها ابزاری پیشرفته است که می‌توان از آن برای مطلع کردن «قیمت پیشنهادی هوشمند» استفاده کرد تا همه داده‌های مربوط به تاریخ‌هایی را که در آن‌ها مشکلی در ردگیری تبدیل حساب وجود داشته است نادیده بگیرد. برای جزئیات بیشتر درباره نحوه عملکرد مستثنا کردن داده‌ها، به صفحه راهنمای مستثنا کردن داده‌ها مراجعه کنید.

مستثنا کردن داده‌ها را به‌صورت برنامه‌نویسی‌شده بااستفاده از منبع BiddingDataExclusion و BiddingDataExclusionService.MutateBiddingDataExclusions با BiddingDataExclusionOperation (create، update، یا remove؛ توجه داشته باشید که BiddingDataExclusion.status فقط خواندنی/OUTPUT_ONLY است) ایجاد، به‌روزرسانی، یا حذف کنید. نمی‌توانید BiddingDataExclusion را در حساب مدیر ایجاد کنید؛ باید آن را در حساب مشتری کارخواه با دامنه CAMPAIGN یا CHANNEL ایجاد کنید.

حوزه

BiddingDataExclusion دارای scope الزامی است که می‌تواند روی مقادیر زیر تنظیم شود. گزینه‌های پیکربندی اضافی مختص دامنه براساس اینکه از کدام دامنه استفاده می‌شود تنظیم می‌شوند.

  • CAMPAIGN: استثنا روی پویش‌های خاصی اعمال شده است. فیلد campaigns را روی فهرستی از نام‌های منبع پویش تنظیم کنید که این کنارگذاری بر آن‌ها اعمال خواهد شد.
  • CHANNEL: استثنا به پویش‌هایی اعمال می‌شود که به انواع کانال خاصی تعلق دارند. فیلد advertising_channel_types را روی فهرستی از مقادیر AdvertisingChannelType تنظیم کنید که این استثنا بر آن‌ها اعمال خواهد شد.

دستگاه‌ها

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

تاریخ و زمان

صرف‌نظر از دامنه و دستگاه‌های اختیاری، هر مستثنا کردن داده‌ها باید تاریخ و زمان شروع و پایان با قالب yyyy-MM-dd HH:mm:ss داشته باشد. مستثنا کردن داده‌ها به گذشته نگاه می‌کند و باید برای رویدادهایی استفاده شود که start_date_time در گذشته و end_date_time در گذشته یا آینده دارند. زمان‌ها براساس منطقه زمانی حساب است.

محدودیت‌ها

هنگام کار با منابع BiddingDataExclusion، محدودیت‌های زیر را درنظر داشته باشید:

  • یک BiddingDataExclusion می‌تواند حداکثر برای ۲۰۰۰ پویش اعمال شود وقتی دامنه روی CAMPAIGN تنظیم شده باشد.
  • هر حساب مشتری، ازجمله حساب‌های مدیر و آزمایشی، می‌تواند در هر زمان حداکثر ۵۰۰ مستثنا کردن داده‌های پیشنهاد قیمت فعال داشته باشد. فراتر رفتن از این حد مجاز منجر به خطای RESOURCE_LIMIT می‌شود.

مثال

مثال زیر نحوه ایجاد مستثنا کردن داده‌ها با دامنه CHANNEL را نشان می‌دهد. بخش‌های نظردهی‌شده نشان می‌دهند که چگونه پویش‌ها را مشخص کنید اگر بخواهید به‌جای آن، یک دامنه CAMPAIGN تنظیم کنید:

جاوا

BiddingDataExclusion DataExclusion =
    BiddingDataExclusion.newBuilder()
        // A unique name is required for every data exclusion.
        .setName("Data exclusion #" + getPrintableDateTime())
        // The CHANNEL scope applies the data exclusion to all campaigns of specific
        // advertising channel types. In this example, the exclusion will only apply to
        // Search campaigns. Use the CAMPAIGN scope to instead limit the scope to specific
        // campaigns.
        .setScope(SeasonalityEventScope.CHANNEL)
        .addAdvertisingChannelTypes(AdvertisingChannelType.SEARCH)
        // If setting scope CAMPAIGN, add individual campaign resource name(s) according to
        // the commented out line below.
        // .addCampaigns("INSERT_CAMPAIGN_RESOURCE_NAME_HERE")
        .setStartDateTime(startDateTime)
        .setEndDateTime(endDateTime)
        .build();

BiddingDataExclusionOperation operation =
    BiddingDataExclusionOperation.newBuilder().setCreate(DataExclusion).build();

MutateBiddingDataExclusionsResponse response =
    DataExclusionServiceClient.mutateBiddingDataExclusions(
        customerId.toString(), ImmutableList.of(operation));
System.out.printf(
    "Added data exclusion with resource name: %s%n",
    response.getResults(0).getResourceName());
      

C#‎

BiddingDataExclusion dataExclusion = new BiddingDataExclusion()
{
    // A unique name is required for every data exclusion.
    Name = "Data exclusion #" + ExampleUtilities.GetRandomString(),
    // The CHANNEL scope applies the data exclusion to all campaigns of specific
    // advertising channel types. In this example, the the exclusion will only apply to
    // Search campaigns. Use the CAMPAIGN scope to instead limit the scope to specific
    // campaigns.
    Scope = SeasonalityEventScope.Channel,
    AdvertisingChannelTypes = { AdvertisingChannelType.Search },
    // The date range should be less than 14 days.
    StartDateTime = startDateTime,
    EndDateTime = endDateTime,
};
BiddingDataExclusionOperation operation = new BiddingDataExclusionOperation()
{
    Create = dataExclusion
};

try
{
    MutateBiddingDataExclusionsResponse response =
        biddingDataExclusionService.MutateBiddingDataExclusions(
            customerId.ToString(), new[] { operation });
    Console.WriteLine($"Added data exclusion with resource name: " +
        $"{response.Results[0].ResourceName}");
}
catch (GoogleAdsException e)
{
    Console.WriteLine("Failure:");
    Console.WriteLine($"Message: {e.Message}");
    Console.WriteLine($"Failure: {e.Failure}");
    Console.WriteLine($"Request ID: {e.RequestId}");
    throw;
}
      

PHP

// Creates a bidding data exclusion.
$dataExclusion = new BiddingDataExclusion(
    [
    // A unique name is required for every data exclusion.
    'name' => 'Data exclusion #' . Helper::getPrintableDatetime(),
    // The CHANNEL scope applies the data exclusion to all campaigns of specific
    // advertising channel types. In this example, the exclusion will only apply to
    // Search campaigns. Use the CAMPAIGN scope to instead limit the scope to specific
    // campaigns.
    'scope' => SeasonalityEventScope::CHANNEL,
    'advertising_channel_types' => [AdvertisingChannelType::SEARCH],
    // If setting scope CAMPAIGN, add individual campaign resource name(s) according to
    // the commented out line below.
    // 'campaigns' => ['INSERT_CAMPAIGN_RESOURCE_NAME_HERE'],
    'start_date_time' => $startDateTime,
    'end_date_time' => $endDateTime
    ]
);

// Creates a bidding data exclusion operation.
$biddingDataExclusionOperation = new BiddingDataExclusionOperation();
$biddingDataExclusionOperation->setCreate($dataExclusion);

// Submits the bidding data exclusion operation to add the bidding data exclusion.
$biddingDataExclusionServiceClient =
    $googleAdsClient->getBiddingDataExclusionServiceClient();
$response = $biddingDataExclusionServiceClient->mutateBiddingDataExclusions(
    MutateBiddingDataExclusionsRequest::build($customerId, [$biddingDataExclusionOperation])
);

printf(
    "Added bidding data exclusion with resource name: '%s'.%s",
    $response->getResults()[0]->getResourceName(),
    PHP_EOL
);
      

Python

bidding_data_exclusion_service: BiddingDataExclusionServiceClient = (
    client.get_service("BiddingDataExclusionService")
)
operation: BiddingDataExclusionOperation = client.get_type(
    "BiddingDataExclusionOperation"
)
bidding_data_exclusion: BiddingDataExclusion = operation.create
# A unique name is required for every data exclusion
bidding_data_exclusion.name = f"Data exclusion #{uuid4()}"
# The CHANNEL scope applies the data exclusion to all campaigns of specific
# advertising channel types. In this example, the exclusion will only
# apply to Search campaigns. Use the CAMPAIGN scope to instead limit the
# scope to specific campaigns.
bidding_data_exclusion.scope = (
    client.enums.SeasonalityEventScopeEnum.CHANNEL
)
bidding_data_exclusion.advertising_channel_types.append(
    client.enums.AdvertisingChannelTypeEnum.SEARCH
)
# If setting scope CAMPAIGN, add individual campaign resource name(s)
# according to the commented out line below.
#
# bidding_data_exclusion.campaigns.append(
#     "INSERT_CAMPAIGN_RESOURCE_NAME_HERE"
# )

bidding_data_exclusion.start_date_time = start_date_time
bidding_data_exclusion.end_date_time = end_date_time

response: MutateBiddingDataExclusionsResponse = (
    bidding_data_exclusion_service.mutate_bidding_data_exclusions(
        customer_id=customer_id, operations=[operation]
    )
)

resource_name: str = response.results[0].resource_name

print(f"Added data exclusion with resource name: '{resource_name}'")
      

Ruby

client = Google::Ads::GoogleAds::GoogleAdsClient.new

operation = client.operation.create_resource.bidding_data_exclusion do |bda|
  # A unique name is required for every data excluseion.
  bda.name = "Seasonality Adjustment #{(Time.new.to_f * 1000).to_i}"

  # The CHANNEL scope applies the data exclusion to all campaigns of specific
  # advertising channel types. In this example, the conversion_rate_modifier
  # will only apply to Search campaigns. Use the CAMPAIGN scope to instead
  # limit the scope to specific campaigns.
  bda.scope = :CHANNEL
  bda.advertising_channel_types << :SEARCH

  # If setting scope CAMPAIGN, add individual campaign resource name(s)
  # according to the commented out line below.
  #
  # bda.campaigns << "INSERT_CAMPAIGN_RESOURCE_NAME_HERE"

  bda.start_date_time = start_date_time
  bda.end_date_time = end_date_time
end

response = client.service.bidding_data_exclusion.mutate_bidding_data_exclusions(
  customer_id: customer_id,
  operations: [operation],
)

puts "Added data exclusion with resource name #{response.results.first.resource_name}."
      

پرل

my $data_exclusion =
  Google::Ads::GoogleAds::V26::Resources::BiddingDataExclusion->new({
    # A unique name is required for every data exclusion.
    name => "Data exclusion #" . uniqid(),
    # The CHANNEL scope applies the data exclusion to all campaigns of specific
    # advertising channel types. In this example, the exclusion will only apply
    # to Search campaigns. Use the CAMPAIGN scope to instead limit the scope to
    # specific campaigns.
    scope                   => CHANNEL,
    advertisingChannelTypes => [SEARCH],
    # If setting scope CAMPAIGN, add individual campaign resource name(s)
    # according to the commented out line below.
    # campaigns     => ["INSERT_CAMPAIGN_RESOURCE_NAME_HERE"],
    startDateTime => $start_date_time,
    endDateTime   => $end_date_time
  });

my $operation =
  Google::Ads::GoogleAds::V26::Services::BiddingDataExclusionService::BiddingDataExclusionOperation
  ->new({
    create => $data_exclusion
  });

my $response = $api_client->BiddingDataExclusionService()->mutate({
    customerId => $customer_id,
    operations => [$operation]});

printf "Added data exclusion with resource name: '%s'.\n",
  $response->{results}[0]{resourceName};
      

curl