How to Train Google’s Algorithm to Buy the Most Valuable Traffic: A Guide to Custom bidding in DV360
Today, a fundamental shift in focus is occurring in the programmatic advertising space: the battle is no longer for reach or the raw number of impressions, but for their actual quality and impact on the bottom line. We live in an era of “data inflation”, where simply securing a conversion is no longer a guarantee of profitability.

Automated bidding strategies operate on a linear logic. They adhere to the principle that “one conversion = equal value”. From the system’s perspective, a newsletter subscription, adding an item to a cart, and purchasing a premium product hold nearly the same priority if they are configured as goals. However, for a real business, this is not the case. This averaged approach leads to marketing budgets failing to concentrate on acquiring the customers who bring the highest value to the business.
To bridge this gap between media metrics and business outcomes, Google developed Custom bidding. This unique DV360 functionality allows advertisers to move beyond standard KPIs. Instead of adapting to Google’s automated bidding strategies, you gain the ability to “train” the AI to evaluate every single impression through the lens of your specific business objectives–ranging from product profit margins to predicted customer lifetime value (LTV).

In this article, we will break down in detail how this technology works, why it remains an exclusive advantage of the Google Marketing Platform ecosystem, and how to build your own algorithm that drives real value for your brand rather than just clicks.
A Fundamental Difference: Key Distinctions from Standard Auto-bidding
To understand the power of Custom bidding, it is worth looking at the mechanics of standard strategies. Automated bidding in DV360 optimizes campaigns based on the probability of a click, a conversion, or viewability. The AI model analyzes historical data and more than 40 auction signals to purchase an impression at the optimal price.

The issue with the standard approach lies in the limitation of its goals. If you select “Maximize Conversions”, the system will fight equally hard for a user who adds a low-cost item to their cart as it does for someone making a high-ticket purchase. Custom bidding changes the rules of the game. It is not about building an algorithm from scratch, but rather “fine-tuning” Google’s existing models. You leverage the same AI horsepower but independently assign a “weight” or point value to each user action.

Four Main Scenarios for Using Custom bidding Algorithms

Custom bidding allows you to operate with data that was previously unavailable for automated bid optimization:
- Transaction ROAS
Optimizing directly for the revenue value passed via Floodlight sales tags or Google Analytics goals. The system automatically adjusts bids to maximize total profit rather than the sheer volume of orders.
- Weighted Conversions
You can map out your entire sales funnel within the algorithm. For example, you can assign 10 points for a product page view, 50 points for a registration, and 100 points for a purchase. This helps the algorithm learn much faster because it recognizes value in every step the user takes, not just the final action.
- Optimization Based on Customer Value
By using custom variables (u-variables) in Floodlight or GA4 goals, you can pass information to the system about the items in a cart, booking duration, product SKUs, or customer loyalty status. The algorithm will bid higher for an impression to a user whose predicted average order value (AOV) is higher.
- Quality of Brand Contact
For media campaigns, the exact way a user sees an ad matters. Custom bidding allows you to factor in creative size, ad position on the page, video view duration, and Active View metrics to ensure the brand is truly visible within the target audience’s field of view.
Comparison: Automated bidding vs. Custom bidding

The main difference between standard bidding strategies and custom algorithms lies in the transition from a binary evaluation of an impression to a differentiated, intelligent score.
1. The Logic of Automated bidding (Standard Automation)
Traditional platform algorithms operate on a simplified performance evaluation system where only two states exist: “yes” or “no.”
- Evaluation Mechanics
If a campaign is optimized for a viewability metric, for instance, a confirmed view of an ad (Ad is Viewed) receives 100% of the value. At the same time, an impression that did not become viewable (Ad is Not Viewed) is marked as completely ineffective and receives 0% value. - Limitations
The automation algorithm does not account for the qualitative characteristics of the view itself. To it, two viewable impressions are absolutely equal, even if the user interacted with the ad for 2 seconds on the first site and for more than 10 seconds on a large screen on the second site.
2. The Logic of Custom bidding (Custom Algorithms)
The custom approach allows the advertiser to independently define which combinations of signals and technical metrics form a truly high-quality media contact. Instead of a rigid “0 or 100” scale, a flexible distribution of value is introduced based on signal strength.
The value of a single impression can dynamically change under the influence of a combination of three factors: viewability (Ad is Viewed), time on screen (ToS > 10 sec), and creative scale (Large Creative):
- 100% Value (The Ideal Impression): Assigned only when all three criteria match–the ad was viewable, played for more than 10 seconds, and utilized a large creative format.
- 70% Value (Format Priority): Awarded if the ad was viewable and used a large creative format, but the duration of contact was less than 10 seconds.
- 40% Value (Duration Priority): Captured when the ad was viewable and held the user’s attention for more than 10 seconds, but the creative format itself was standard or small.
Why This Matters for Campaign Optimization
Implementing Custom bidding fundamentally changes the training vector of the DV360 neural network. Instead of blindly buying up any inventory that formally falls under the viewability criterion, the algorithm learns to identify which impressions yield the highest value for achieving business objectives.
Types of Custom bidding

Custom bidding calculations are based on mathematical modeling that allows different types of signals to be combined into a single impression evaluation system. This makes it possible not just to record the fact that an action was completed, but to weigh its context.
Components of the Mathematical Model
For accurate impression scoring, the algorithm aggregates a sum of baseline points and multiplies it by coefficients that reflect the quality or conditions of the impression itself.
- Baseline Points
These are quantitative metrics of user interaction with the ad–for example, whether a conversion or a click occurred. Each action is assigned its own weight, reflecting its significance to the business. - Coefficients (Multipliers)
These are qualitative parameters that amplify or diminish the value of a baseline action depending on the impression conditions. These include device type (e.g., mobile) or the position of the ad on a website page.
Practical Example of Value Calculation
Three different ad impressions (A, B, and C) receive completely different final values for the purchasing algorithm thanks to the combination of points and multipliers.
- Impression A (Maximum Value): The user completed a conversion (9 points) and clicked on the ad (1 point) on a mobile device (multiplier of 2) from a top ad position (multiplier of 5). The calculation formula (9+1)×2×5 yields a final impression value of 100. This is high-priority traffic that the system will fight for most aggressively.
- Impression B (Minimum Value): In this case, there was no conversion (0 points), and only a click was recorded (1 point) on mobile (multiplier of 2), while data regarding the ad position is missing. The calculation formula (0+1)×2 translates into a final impression value of 2. The algorithm marks such inventory as low priority.
- Impression C (Zero Value): The impression occurred in a good ad position (multiplier of 4), but the user did not perform a single baseline action–neither a click nor a conversion (0 points). The mathematical logic (0+0)×4 results in an impression value of 0. For the algorithm, this impression holds no value, so the system will stop spending budget on similar placements.
Impact on bidding Strategy
This approach allows you to move beyond standard optimization. Instead of evaluating all conversions or clicks as identical, Custom bidding helps the system see exactly what factors accompanied that conversion. If a purchase occurred from a mobile device and a premium position, the artificial intelligence instantly reads this signal and adjusts the bidding model to buy more of exactly this highly-converting, high-quality inventory.
Attention-based bidding

Modern media analysis is increasingly moving away from evaluating clicks and toward measuring real audience engagement. The Attention-based bidding strategy in DV360 allows you to configure the algorithm to purchase inventory that guarantees maximum user attention to the advertising message.
1. Placement & User Context
This category of signals describes the external conditions under which the advertising contact occurs. They reflect where and when the ad is displayed and are completely independent of the parameters of the creative itself. They include:
- Time and Geolocation
Hour of Day, Day of Week, and the user’s geographic location (Geo).
- Technical Environment
Operating System and Device Type. - Placement Quality
Site category/Channel, as well as the specific Site/Domain.
This data helps the system predict engagement potential in advance–for example, lowering bids during hours of lowest activity or on websites with low attention retention rates.
2. Quality of Impression and Attention Metrics (Attention Proxies)
This is the core block for Attention-based models. Attention proxy metrics determine the quality of an impression based on whether the user had a physical opportunity to notice and process the advertisement. This includes parameters that directly impact viewability and interaction:
- Viewability and Sound: The actual viewability of the banner or player (Viewable) and whether the sound was turned on during video playback (Audible).
- Contact Time: The duration of time the advertisement remained on the device screen (Time on screen).
- Player and Creative Characteristics: The physical size of the ad unit (Creative Size / Dimensions), video interface dimensions (Video Player Size), and whether the window was resized by the user (Video Resized).
Business Value of the Approach
Combining contextual signals and attention metrics allows the DV360 algorithm to calculate the probability of a high-quality media contact even before a bid is placed. For example, the system sees that an impression is planned on desktop, on a premium domain, within a large player format, and with a high probability of retaining playback duration.
For Attention-based bidding, such a set of signals serves as a trigger for the highest impression value. The algorithm will automatically increase the bid to win this premium inventory, and conversely, it will minimize spend on impressions where the ad might load but will be scrolled past by the user in a fraction of a second.
Conversion-based bidding

1. Leveraging All Conversion Data for Optimization
The core idea is that not all conversions hold equal importance for a business. Custom bidding allows you to focus on the user actions most valuable to you without losing sight of other useful conversions.
2. How It Works (Using the Floodlight Funnel Example)
Instead of optimizing for just one final action or for all actions with equal weight (as standard automated bidding typically does), a custom algorithm takes into account the entire conversion structure (in accordance with configured Floodlight tags):
- Landing Page (Page View): The baseline action with the lowest value (gray color).
- Form Completion Started: An action indicating higher interest (red color).
- Form Completion Finalization: Step-by-step toward success (orange color).
- Form Submitted Successfully: The most valuable conversion (green color).
3. Feeding the Machine Learning Algorithm (Comparison with Auto bidding)
The chart on the right clearly demonstrates the difference in the volume of signals the algorithm receives for training:
- Auto bidding (Standard Automated bidding): Focuses predominantly on a single type of signal (e.g., only successful form submissions). Because of this, the volume of data available for training the algorithm is very small (the short green bar).
- Custom bidding: Gathers and integrates signals from all stages of the funnel (from the landing page to the final submission). Thanks to this, the machine learning algorithm receives a significantly larger volume of data (the “signals bar” becomes taller and more diverse), allowing it to train faster and more effectively, predict results more accurately, and optimize inventory purchasing more efficiently.
The Process of Creating Your Own Algorithm Using the Goal Builder in the DV360 UI

The efficiency of programmatic buying depends directly on the accuracy of media inventory valuation. In Display & Video 360, Custom bidding technology allows advertisers to step away from standard clicks or conversions and independently determine the value of each ad impression.
As the platform’s logic demonstrates, there are two fundamental tools available for implementing an optimization algorithm to satisfy different analytical business needs.
Native Goal Builder in the Interface
The first approach is based on using built-in DV360 tools without needing to write code. It is designed for rapid modeling of value based on existing sales funnel stages.
A specialist assigns weight coefficients to various Floodlight activities directly within the platform’s interface. This enables the system to distinguish between the value of simple actions (such as viewing a product page) and final transactions. This method is the optimal choice for classic e-commerce campaigns where the primary goal is optimization for weighted conversions, maximizing current revenue, or accounting for baseline offline sales data. Its key advantages lie in setup speed, transparency, and eliminating the need to involve developers.

Custom Scripts in Python
To solve non-standard business challenges that extend beyond linear user interactions, DV360 supports the integration of custom scripts written in Python. This is an enterprise-grade tool for creating flexible inventory valuation models.
Using code allows you to embed more than 40 diverse parameters and functions into the algorithm, combining them via conditional logic. This method is essential for optimizing campaigns based on complex business metrics, such as estimated net profit (margin), customer lifetime value (LTV), deep on-site engagement based on Google Analytics 4 signals, or specific brand metrics. The main advantage of Python scripts is their virtually unlimited flexibility, which allows you to train the algorithm to purchase only those impressions that deliver genuine business value.

Operating Principle and Algorithm Training
Regardless of the chosen tool – the native builder or a Python script–the fundamental mechanics of Custom bidding operate on a closed loop of machine learning.
First, based on the rules or code you define, the system calculates an individual score, determining the exact value of each individual impression. Following this, the DV360 algorithms analyze the collected data and identify patterns in audience and placement characteristics to construct a predictive model. In the final stage, the trained model optimizes bids in real time, focusing the budget on purchasing inventory with the highest predicted value.
Thus, the choice between the interface and code comes down to a balance between launch speed and the required depth of business data integration into the media buying process.
Goal Builder in the DV360 UI

A script can be built based on the following core metrics and signals:
1. Conversions
These are the key signals for value optimization mentioned in the text and interface:
- Floodlight Data: Utilizing tracking tags for actions on the site (such as page views, starting or finalizing form completions, and purchases).
- Google Analytics 4 (GA4) Events: Integrating custom events that a user performs on a web resource or within an application.
- Custom Variables: Passing additional dynamic parameters alongside a conversion (e.g., order total, product category, customer type, etc.).
2. Clicks
- Optimization and bidding based on signals that maximize the number of user click-throughs to your target site or landing page (specifically utilizing rule logic to evaluate the “quality” or clickability of individual impressions).
3. Brand Awareness / Impressions
- Utilizing media signals to increase brand visibility and reach a wider audience (for example, a script can account for banner viewability–Active View, duration of ad contact, or an impression within a specific premium inventory category).
How is This Combined in a Script?
The process of creating an algorithm involves building scoring logic. In the script, you write rules and mathematical weight coefficients (points) for each type of signal.
Example Script Logic:
- If a simple impression or click leading to the site occurs → assign 1 point to the impression.
- If a user navigates further and begins filling out a form (a micro-conversion signal) → assign 20 points.
- If a final conversion is recorded (a purchase or successful form submission from Floodlight/GA4) → assign the highest value, such as 100 points.
In this way, the script “explains” to the DV360 artificial intelligence which combinations of impressions, clicks, and conversions are worth paying more for to buy the most valuable traffic for the business.
The Process of Creating a Custom Algorithm
Implementing Custom bidding consists of several technical stages, where each step influences the final efficiency of the campaign:
- Defining the Goal and Gathering Signals
First and foremost, it is necessary to understand which user actions correlate most closely with profit. For this, Floodlight data, Google Analytics 4 events, or custom variables are utilized. - Building Scoring Logic
You create a script that tells the system: “If a user views 3 pages of the site, give this impression 20 points; if they spend more than 2 minutes on the site, give it 50 points.” You can also add negative coefficients for irrelevant locations or devices. - Testing and Training
After uploading the script, the system requires time to learn. This typically takes a few weeks, during which the algorithm analyzes auction results and the correlation between bids and the “points” of value achieved.

When creating Custom bidding algorithms based on custom rules, it is absolutely critical to define exactly how the system will handle multiple signals if they trigger simultaneously during a single impression. For this purpose, three basic aggregation methods are used in the script code, each of which completely changes the calculation logic for the final inventory value. The developer has access to the following three ways to calculate the final score:
1. Summing Results
This method operates on a cumulative effect principle, where all useful user actions or impression characteristics are added together. The script analyzes the entire set of defined rules and sums the points for each one that proved successful. For example, if two different rules triggered during an impression (one with a value of 1, the other with a value of 1), the algorithm will output a final result of 2. This approach is optimal when it is important to capture every micro-conversion or additional engagement signal, accumulating the total value of contact with the audience.
2. Choosing the Maximum Value
The logic of this method lies in identifying the highest-priority and most significant event among all those that occurred within a single ad impression. Instead of adding points, the script compares the outcomes of all triggered rules and selects only one–the one with the largest weight. If several signals are recorded with values of 0.8, 1, and 0.2, the final score for the entire impression becomes 1. This method is perfectly suited for campaigns with clearly defined priorities, where reaching a macro-goal completely nullifies the value of intermediate funnel stages.
3. First Successful Match
This method is based on a rigid hierarchical rule structure where the sequence of execution is of critical importance. The algorithm checks custom rules sequentially, from top to bottom, as they are written in the code. As soon as the system encounters the first rule whose conditions are met, it assigns its score to the impression (e.g., 0.8) and completely halts further analysis, ignoring any other triggers lower on the list. This method is used for building complex cascading models where the advertiser needs to cleanly segment the audience or conversion types based on the primary interaction attribute.
Summary for Campaign Architecture
The choice of calculation method directly shapes the behavior of the DV360 artificial intelligence at auction. A cumulative sum_aggregate will force the system to search for multi-vector engagement, max_aggregate will focus exclusively on the highest-value actions, and first_match_aggregate will allow for tight budget control in alignment with your defined signal hierarchy.
Custom bidding Powered by Google Sheets

For many media buyers and marketing teams, the need to write Python code serves as the primary barrier to adopting Custom bidding. To solve this problem and automate the process, there is an official solution from Google available on GitHub. It allows you to generate complex bidding algorithms using the familiar interface of Google Sheets.
Tool Architecture and Operational Logic
Instead of manually programming if/else logic, a specialist fills out a standardized sheet consisting of several key blocks:
- Identification Block (User Inputs)
At the initial stage, basic system parameters are specified, such as the DV360 Partner ID and DV360 Advertiser ID. Here, the data processing method (Aggregation Method) is also chosen from a dropdown list–for example, max_aggregate. - Flexible Conditions and Weight Coefficients (Condition & Weight)
For each rule, its sequence number and mathematical weight are set (e.g., 150, 100, or 50), which determines the value of the impression when conditions are met. - Logical Expression Builder
Using simple selectors, you configure relationships between variables. You can combine parameters such as clicks (click), device types (device_type), time on screen (time_on_screen_seconds), viewability (active_view_viewed), and banner dimensions (creative_width / creative_height). Standard logical operators AND and OR are used to link multiple signals.
Validation and Exporting the Ready Script
Once the sheet configuration is complete, the user does not need to combine variables manually. The interface contains two functional buttons that finalize the automation process:
- QA Script Inputs
Launches an automated syntax and logic check for your configured rules, eliminating the risk of errors occurring during future algorithm execution. - Final Script to Copy
Generates a final, fully production-ready Python script. The specialist only needs to copy this code in a single click and paste it directly into the designated field within the DV360 interface.
Business Benefits of This Approach
Utilizing the GitHub solution based on Google Sheets allows you to scale your work with custom strategies. Media buyers receive a tool that blends the simplicity of the native goal builder with the technical capabilities of Python scripts. This significantly cuts down the time required to develop and test new hypotheses, allowing multi-factor traffic evaluation models to be built without involving programmers.
Performance Testing Methodology for Custom bidding: Experiments in DV360

Any implementation of new marketing automation technologies requires rigorous verification. When transitioning to Custom bidding, advertisers often make the mistake of comparing results on a “period-over-period” basis. However, in the dynamic programmatic environment, this approach is not representative. Final numbers are heavily influenced by external factors: shifts in the auction landscape, competitor activity, seasonal demand fluctuations, or even browser updates.
To get clean results and understand the true impact of a custom algorithm on business metrics, a scientific approach is required. The only relevant method for testing hypotheses in DV360 is running a controlled A/B test via the built-in Experiments tool.
This functionality isolates the impact of the bidding strategy from all other factors. You create two identical environments (test and control) where the sole variable is the bidding algorithm itself. Only this format of testing provides confidence that the growth in value is a result of your script’s performance rather than market coincidences.
You split your inventory into two identical groups:
- The Control Group uses a standard strategy (e.g., Maximize Conversions).
- The Test Group operates based on your Custom bidding script.
This approach reveals the clean Lift in value. You will notice that even if the CPA in the test group remains identical or slightly higher, the total revenue or the volume of “heavy” conversions (such as high-value orders) increases substantially.
An Evolutionary Approach: Moving from Simple to Complex
One of the largest hurdles when moving to custom strategies is an advertiser’s desire to immediately build an “ideal algorithm” that accounts for dozens of variables. However, practice shows that attempting to launch a “monster algorithm” right at the start frequently leads to a lack of data for the AI to learn from.
The most effective strategy is the gradual complication of the model. This allows the algorithm to train stably while the team sees the actual impact of each new variable on the overall result.
Stage 1: Weighted Funnel (Weighted Conversions)
The first and most important step is to teach the system to distinguish between micro- and macro-conversions. Instead of optimizing solely for the final purchase (which might not provide enough volume for fast algorithm training), we assign a “weight” or points to each user action within the funnel.
- Viewing a key page = 1 point (interest signal).
- Registration on the site = 10 points (high intent).
- Transaction = 100 points (final goal).
This hierarchy provides the DV360 algorithm with a massive array of data. Even if transactions are sparse, the system detects thousands of “minor” value signals and faster conceptualizes which user profile is more likely to make it to the end.
Stage 2: Utilizing Custom Variables (u-variables)
Once the point-based model has stabilized, it is time to move on to integrating real business metrics. At this stage, we leverage custom Floodlight variables (u-variables), which allow specific information about an event to be passed into the script.
This enables the algorithm to make decisions based on:
- Profitability: Setting a higher bid for the purchase of products with higher margins.
- Product Categories: Prioritizing traffic acquisition for new collections or overstock inventory.
- Customer Status: Distinguishing new users from existing ones, which is critical for prospecting strategies.
At this level, your advertising is no longer just hunting for buyers–it is hunting for profitable buyers.
Stage 3: Synergy with the Google Cloud Ecosystem
This represents the highest level of maturity in media buying, where advertising strategy fully merges with business analytics. By leveraging integration with BigQuery, you can upload complex predictive models directly into DV360.
The algorithm gains access to data that cannot be collected by a website pixel alone:
- Predicted LTV (Lifetime Value): The system buys ad impressions for users who, according to your data, will remain with the brand for years.
- Offline Data: Incorporating sales from brick-and-mortar stores or call centers to adjust online bidding.
- Complex Attribution Models: Evaluating the actual contribution of each impression within a multi-channel funnel.
This deep integration transforms DV360 into an intelligent hub that buys long-term profitability for the entire business rather than just traffic.
Measuring Performance and Best Practices
Transitioning to Custom bidding requires a paradigm shift in how results are evaluated. While in standard campaigns we focus on Cost Per Acquisition (CPA), in custom strategies the primary orientation becomes Total Value. The key indicator of success here is not how cheaply we acquired a conversion, but how high-quality and profitable a “volume” of these conversions we achieved for the exact same budget.

Synergy within the Google Marketing Platform
Full integration across GMP products converts Custom bidding into an autonomous decision-making engine. Data gathered by Google Analytics automatically becomes the fuel for DV360. Thanks to this, you create a seamless experience: analytics captures the nuances of user behavior, and the algorithm receives instructions in that very second on what bid to place at the next auction. This elevates media buying from a mechanical process to the strategic management of business value.
Custom bidding in DV360 is the logical next step for teams that have already exhausted the potential of standard strategies and are looking for methods of deeper optimization. Instead of relying on baseline algorithms, you gain the opportunity to independently set priorities for the AI. This transforms media buying from a mechanical execution into a core business asset.
This material is based on webinars by CoobX, an official GMP Sales Partner.