Once you've gathered the targeting settings and a product mix for your media
plan, you can generate a curve of budgets versus potential reach using the GenerateReachForecast
method in ReachPlanService
. See the glossary
and media plan
guide
for details on the request fields.
Save curves
You can only save individual curves to provide convenience for your users. Caching curves en masse is strictly prohibited. If you do need to generate curves en masse, check first with your Google representative.
Changes for YouTube Select
YouTube Select (YTS) in Reach Plan Service now supports lineup-level targeting, as compared to Run-of-Network previously, for all eligible YTS locations on Instant Reserve pricing. With Instant Reserve, these errors may also occur when requesting a forecast for YTS:
Forecast reach for Demand Gen
When generating curves for DEMAND_GEN
plannable products, you must also
include an expected conversion rate for each product.
To obtain conversion rate suggestions for supported plannable products, use the GenerateConversionRates
method.
Code example
The curve includes impression and user reach in absolute numbers, as well as universe sizes corresponding to the census population and YouTube audience size for the requested demographic and country.
Java
private void getReachCurve ( ReachPlanServiceClient reachPlanServiceClient , GenerateReachForecastRequest request ) { GenerateReachForecastResponse response = reachPlanServiceClient . generateReachForecast ( request ); System . out . println ( "Reach curve output:" ); System . out . println ( "Currency, Cost Micros, On-Target Reach, On-Target Imprs, Total Reach, Total Imprs," + " Products" ); for ( ReachForecast point : response . getReachCurve (). getReachForecastsList ()) { System . out . printf ( "%s, \"" , Joiner . on ( ", " ) . join ( request . getCurrencyCode (), String . valueOf ( point . getCostMicros ()), String . valueOf ( point . getForecast (). getOnTargetReach ()), String . valueOf ( point . getForecast (). getOnTargetImpressions ()), String . valueOf ( point . getForecast (). getTotalReach ()), String . valueOf ( point . getForecast (). getTotalImpressions ()))); for ( PlannedProductReachForecast product : point . getPlannedProductReachForecastsList ()) { System . out . printf ( "[Product: %s, " , product . getPlannableProductCode ()); System . out . printf ( "Budget Micros: %s]" , product . getCostMicros ()); } System . out . printf ( "\"%n" ); } }
C#
public void GetReachCurve ( ReachPlanServiceClient reachPlanService , GenerateReachForecastRequest request ) { GenerateReachForecastResponse response = reachPlanService . GenerateReachForecast ( request ); Console . WriteLine ( "Reach curve output:" ); Console . WriteLine ( "Currency, Cost Micros, On-Target Reach, On-Target Impressions, Total Reach," + " Total Impressions, Products" ); foreach ( ReachForecast point in response . ReachCurve . ReachForecasts ) { Console . Write ( $"{request.CurrencyCode}, " ); Console . Write ( $"{point.CostMicros}, " ); Console . Write ( $"{point.Forecast.OnTargetReach}, " ); Console . Write ( $"{point.Forecast.OnTargetImpressions}, " ); Console . Write ( $"{point.Forecast.TotalReach}, " ); Console . Write ( $"{point.Forecast.TotalImpressions}, " ); Console . Write ( "\"[" ); foreach ( PlannedProductReachForecast productReachForecast in point . PlannedProductReachForecasts ) { Console . Write ( $"(Product: {productReachForecast.PlannableProductCode}, " ); Console . Write ( $"Budget Micros: {productReachForecast.CostMicros}), " ); } Console . WriteLine ( "]\"" ); } }
PHP
private static function getReachCurve( GoogleAdsClient $googleAdsClient, int $customerId, array $productMix, string $locationId, string $currencyCode ) { // Valid durations are between 1 and 90 days. $duration = new CampaignDuration(['duration_in_days' => 28]); $targeting = new Targeting([ 'plannable_location_id' => $locationId, 'age_range' => ReachPlanAgeRange::AGE_RANGE_18_65_UP, 'genders' => [ new GenderInfo(['type' => GenderType::FEMALE]), new GenderInfo(['type' => GenderType::MALE]) ], 'devices' => [ new DeviceInfo(['type' => Device::DESKTOP]), new DeviceInfo(['type' => Device::MOBILE]), new DeviceInfo(['type' => Device::TABLET]) ] ]); // See the docs for defaults and valid ranges: // https://developers.google.com/google-ads/api/reference/rpc/latest/GenerateReachForecastRequest $response = $googleAdsClient->getReachPlanServiceClient()->generateReachForecast( GenerateReachForecastRequest::build($customerId, $duration, $productMix) ->setCurrencyCode($currencyCode) ->setTargeting($targeting) ); printf( "Reach curve output:%sCurrency, Cost Micros, On-Target Reach, On-Target Imprs," . " Total Reach, Total Imprs, Products%s", PHP_EOL, PHP_EOL ); foreach ($response->getReachCurve()->getReachForecasts() as $point) { $products = ''; /** @var ReachForecast $point */ foreach ($point->getPlannedProductReachForecasts() as $plannedProductReachForecast) { /** @var PlannedProductReachForecast $plannedProductReachForecast */ $products .= sprintf( '(Product: %s, Budget Micros: %s)', $plannedProductReachForecast->getPlannableProductCode(), $plannedProductReachForecast->getCostMicros() ); } printf( "%s, %d, %d, %d, %d, %d, %s%s", $currencyCode, $point->getCostMicros(), $point->getForecast()->getOnTargetReach(), $point->getForecast()->getOnTargetImpressions(), $point->getForecast()->getTotalReach(), $point->getForecast()->getTotalImpressions(), $products, PHP_EOL ); } }