Custom bidding scripts lets you optimize impression values using first-party data from:

  • Floodlights
  • Impression level data
  • Google Analytics

The sample scripts on this page uses advanced custom bidding fields to help demonstrate how you can use data that represents the key performance indicator (KPI) you want to optimize towards for your custom bidding algorithm.

The sample scripts in this topic uses the following aggregate models:

  • first_match_aggregate
  • max_aggregate
  • sum_aggregate 

When you create a custom bidding script, you’ll use the following syntax rules:

  • Enclose all criteria in brackets [ ]
  • A comma , also represents "and"

For example:

In this sample script, criteria1 returns true only if criteria_a and criteria_b are both true. While criteria2 returns true if criteria_a is true.

return aggregate_function([
 ([criteria_a, criteria_b], score), #criteria1
 ([criteria_a], score) #criteria2
Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue

Clear search
Close search
Google apps
Main menu
Search Help Center