Using impression level data

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_viewed
  • time_on_screen_seconds
  • completed_in_view_audible

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. Returns true for 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.
return max_aggregate([
  ([active_view_viewed], score A),
  ([time_on_screen_seconds > 10], score B),
  ([completed_in_view_audible], score C)
])

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 creative 
  • creative_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
])

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
return max_aggregate([
  ([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),
])

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
2024 Privacy Readiness guide

Prepare for a world without third-party cookies and unlock the AI
opportunity by adopting the right durable audience and measurement
solutions.
Start Today

Search
Clear search
Close search
Google apps
Main menu
14886721045950852765
true
Search Help Center
true
true
true
true
true
69621
true
false