The following sample scripts use Floodlight data to inform their custom bidding algorithm:
- Sales revenue Floodlight tag
- Weighted conversions using a combination of Floodlights
- Custom Floodlight variables
Sales revenue Floodlight tag
You can create a custom bidding script that optimizes towards sales revenue tracked by Floodlight Sales tag using total_conversion_value
.
Sample script
Floodlight_ID
: Specify your activity ID.model_id
:- If you've set up an attribution model at the advertiser level, specify your Attribution Model ID.
- If not, specify
0
to use last-touch attribution.
Weighted conversions using a combination of Floodlights
You can optimize to 3 different conversions activities, where each activity is worth a different value using the sum_aggregate
to sum the value of multiple conversions:
- If an impression leads to different conversions: The values of conversions are summed when attributing value to the impression.
- If an impression leads to multiple conversions for the same activity ID: The number of conversions are summed and then multiplied by the conversion weighting.
- A car manufacturer is tracking conversions on minivan, SUV, and sedan product pages. To optimize toward value, each category is assigned different values.
- A nonprofit wants to optimize for donation events since donation events are rare. They can add upper-funnel activities and assign lower weights to them to drive volume. For example, clicks on “Learn more about the organization” and “See how you can help”.
Sample script
sum_aggregate
:Floodlight_ID1
,Floodlight_ID2
,Floodlight_ID3
: Specify your activity IDs. For example: 123456, 456789, 78901.model_id
:- If you've set up an attribution model at the advertiser level, specify your Attribution Model ID.
- If not, specify
0
to use last-touch attribution.
weighting_1
,weighting_2
,weighting_3
: Specify a weight for each conversion activity. For example: 100, 5, or 0.2.
([total_conversion_count(Floodlight_ID_1, model_id)>0], total_conversion_count(Floodlight_ID_1, model_id)*weighting_1),
([total_conversion_count(Floodlight_ID_2, model_id)>0], total_conversion_count(Floodlight_ID_2, model_id)*weighting_2),
([total_conversion_count(Floodlight_ID_3, model_id)>0], total_conversion_count(Floodlight_ID_3, model_id)*weighting_3)
])
Variations to optimizing multiple conversion activities
There are variations to how you can optimize multiple conversions activities.
- You can change the number of weighted conversion activities by removing or adding new conditions.
- You can assign the value of the highest-value conversion event by using
max_aggregate
. - To assign the value of the first matching conversion event, based on the order in your script, use
first_match_aggregate
.
Sample script
return max_aggregate([
([click], weight_1),
([total_conversion_count(Floodlight_ID_1, model_id)>0], weight_2)])
Sample script
return sum_aggregate([
([click, total_conversion_count(Floodlight_ID_1, model_id)>0], weight_1),
([not click, total_conversion_count(Floodlight_ID_1, model_id)>0], weight_2)])
Custom Floodlight variables
You can create a script that optimizes toward a single custom Floodlight variable for a single floodlight activity using conversion_custom_variable
.
When using u-variables in custom bidding scripts, they must be shared with Display & Video 360 first:
- Navigate to Resources > Floodlight Group.
- Select a Floodlight activity.
- For Custom Floodlight variables, choose the view icon.
- Check the box next to the u-variable.
Real-world example
A car-rental chain wants to optimize for the number of vehicle reservations. The reservation confirmation activity is tracked in a Floodlight, and the number of nights booked in a Custom Floodlight variable.
Sample script
The following script example optimizes to a single custom Floodlight variable for a single Floodlight activity. The script returns a string if there's a conversion or None
if there's no conversion. All non-converting impressions as valued as 0
. Any impression that is not attributed by the model will return as None
and be valued as 0
:
Floodlight_ID
: Specify your activity ID.model_id
:- If you've set up an attribution model at the advertiser level, specify your Attribution Model ID.
- If not, specify
0
to use last-touch attribution.
u_variable_index
: Specify the Custom Floodlight u-variable index for your activity ID.
_uvar = conversion_custom_variable(
Floodlight_ID, model_id, u_variable_index)
if _uvar != None and _uvar != "":
return float(_uvar)
return 0