The following sample scripts use impression level data to inform their custom bidding algorithm.
Maximizing brand
You can create a custom bidding script that optimizes toward maximizing brand related key performance indicators (KPIs) such as:
active_view_viewedtime_on_screen_secondscompleted_in_view_audibleaudio_completed
To explore additional fields, go to advanced custom bidding fields.
Real-world example
An e-commerce advertiser wants to run a campaign to launch a new product. The campaign's KPIs will focus on maximizing brand, so they optimize custom bidding toward metrics that measure brand exposure to their users.
Sample script
The following sample script is one way you could maximize brand using max_aggregate. The scores A, B, and C specifies the weight for which to prioritize each metric:
active_view_viewed: Represents impressions where the display or video ad was viewable according to Active View.time_on_screen_seconds: Specify the length of time a video is on-screen in seconds. Returnstruefor impressions that meet the view time specified.completed_in_view_audible: Represents impressions where the video was visible with the audio ON until the end of the video.audio_completed: Represents impressions where the audio clip played to completion.
([active_view_viewed], score A),
([time_on_screen_seconds > 10], score B),
([completed_in_view_audible], score C),
([audio_completed], score A)
])
For a campaign using a display creative, you may want to use creative size to maximize the brand opportunities, The scores X, Y, and Z specify the weight for each combination of metrics:
creative_width: Represents the pixel width of a creativecreative_height: Represents the pixel height of a creative
return max_aggregate([
([time_on_screen_seconds > 10, creative_width == 300, creative_height == 600], score X),
([time_on_screen_seconds >=3, time_on_screen_seconds <= 10,creative_width == 300, creative_height == 600],score Y),
([time_on_screen_seconds < 3, creative_width == 300, creative_height == 600], score Z
])
Audio
Audio campaigns can also benefit from Custom Bidding by optimizing toward brand awareness goals, such as maximizing the number of completed audio ad listens.
Real-world example
An advertiser wants to run an audio campaign to build brand awareness. They want to optimize their bids for users who are most likely to listen to the entire audio ad.
Sample script
The following sample script is one way you could maximize completed audio listens using max_aggregate. The score A specifies the weight for which to prioritize the metric:
audio_completed: Represents impressions where the audio clip played to completion. An event is logged only once per impression, even if the user restarts or replays the clip. A completion is logged even if the user skips parts of the audio, as long as the endpoint is reached.
([audio_completed], score A
])
CTV
Connected TV campaigns can also benefit from Custom Bidding. However, scripts intended to be used with CTV campaigns don't support scoring based on domain.
Real-world example
An e-commerce advertiser wants to run a campaign to launch a new product, they know their target audience will be watching content mainly in the evening and in the early morning.
Sample script
The following sample script is one way you could maximize brand using max_aggregate. The scores A, B, and C specifies the weight for which to prioritize time period:
hour_of_day: Represents the hour of the day the ad is shown
([0 <= hour_of_day < 7], score A),
([7 <= hour_of_day < 9], score B),
([9 <= hour_of_day < 18], score C),
([18 <= hour_of_day < 22], score B),
([22 <= hour_of_day <= 23], score A),
])