Register for one of our Google Ads API Migration Workshops (October 5, 2021 - October 14, 2021)

Create Seasonality Adjustments

Seasonality adjustments are an advanced tool that can be used to inform Smart Bidding of expected changes in conversion rates for upcoming future events. For more details about how seasonality adjustments work, refer to the seasonality adjustments help page.

Create seasonality adjustment programmatically using BiddingSeasonalityAdjustments.

Scope

BiddingSeasonalityAdjustments have a required scope that can be set to following values. Additional scope-specific configuration options are set according to which scope is used.

  • CAMPAIGN - The adjustment is applied to specific campaigns. Set the campaigns field to a list of campaign resource names to which this adjustment will apply.
    • The maximum number of campaigns per BiddingSeasonalityAdjustment is 2,000.
  • CHANNEL - The adjustment is applied to campaigns that belong to specific channel types. Set the advertising_channel_types field to a list of AdvertisingChannelTypes to which this adjustment will apply.

Devices

In addition to their scope, seasonality adjustments can be configured with an optional list of device types to which the adjustment will apply. If devices is set, the seasonality adjustment will only be applied to traffic from the specified device types. If not specified, all device types are included in the adjustment.

Dates, times, and the conversion rate modifier

Aside from the scope and optional devices, each seasonality adjustment has start_date_time and end_date_time and a conversion_rate_modifier. The date and times define the future interval that the adjustment applies to, and the modifier is the expected conversion rate multiplier to apply. The date times are in the account's timezone.

Example

The following example shows how to create a seasonality adjustment with CHANNEL scope. Commented out sections demonstrate how to specify campaigns if you were to instead set a CAMPAIGN scope.

Java

BiddingSeasonalityAdjustment seasonalityAdjustment =
    BiddingSeasonalityAdjustment.newBuilder()
        // A unique name is required for every seasonality adjustment.
        .setName("Seasonality adjustment #" + getPrintableDateTime())
        // The CHANNEL scope applies the conversionRateModifier to all campaigns of specific
        // advertising channel types. In this example, the conversionRateModifier 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)
        // The conversionRateModifier is the expected future conversion rate change. When this
        // field is unset or set to 1.0, no adjustment will be applied to traffic. The allowed
        // range is 0.1 to 10.0.
        .setConversionRateModifier(conversionRateModifier)
        .build();

BiddingSeasonalityAdjustmentOperation operation =
    BiddingSeasonalityAdjustmentOperation.newBuilder()
        .setCreate(seasonalityAdjustment)
        .build();

MutateBiddingSeasonalityAdjustmentsResponse response =
    seasonalityAdjustmentServiceClient.mutateBiddingSeasonalityAdjustments(
        customerId.toString(), ImmutableList.of(operation));
System.out.printf(
    "Added seasonality adjustment with resource name: %s%n",
    response.getResults(0).getResourceName());
      
      

C#

This example is not yet available in C#; you can take a look at the other languages.
    

PHP

// Creates a bidding seasonality adjustment.
$seasonalityAdjustment = new BiddingSeasonalityAdjustment([
    // A unique name is required for every seasonality adjustment.
    'name' => 'Seasonality adjustment #' . Helper::getPrintableDatetime(),
    // The CHANNEL scope applies the conversionRateModifier to all campaigns of specific
    // advertising channel types. In this example, the conversionRateModifier 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,
    // The conversionRateModifier is the expected future conversion rate change. When this
    // field is unset or set to 1.0, no adjustment will be applied to traffic. The allowed
    // range is 0.1 to 10.0.
    'conversion_rate_modifier' => $conversionRateModifier
]);

// Creates a bidding seasonality adjustment operation.
$biddingSeasonalityAdjustmentOperation = new BiddingSeasonalityAdjustmentOperation();
$biddingSeasonalityAdjustmentOperation->setCreate($seasonalityAdjustment);

// Submits the bidding seasonality adjustment operation to add the bidding seasonality
// adjustment.
$biddingSeasonalityAdjustmentServiceClient =
    $googleAdsClient->getBiddingSeasonalityAdjustmentServiceClient();
$response = $biddingSeasonalityAdjustmentServiceClient->mutateBiddingSeasonalityAdjustments(
    $customerId,
    [$biddingSeasonalityAdjustmentOperation]
);

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

Python

This example is not yet available in Python; you can take a look at the other languages.
    

Ruby

This example is not yet available in Ruby; you can take a look at the other languages.
    

Perl

This example is not yet available in Perl; you can take a look at the other languages.