Using data from Google Analytics

You can use Google Analytics 4 to inform your custom bidding strategy. This topic provides information about prerequisites to using Google Analytics with Display & Video 360 and sample scripts using data from Google Analytics 4.

Topics in this article

Prerequisite

To use Google Analytics with Display & Video 360 for custom bidding, you must:

  1. Link your Google Analytics account to Display & Video 360 to make sure that both accounts are sharing data.
  2. If you haven't yet, create an event in Google Analytics.

There must be sufficient conversion data to inform your custom bidding strategy for your script to score impressions.You can verify the volume of data by generating a report based on the last non-direct click model in Google Analytics:

For Google Analytics 4:

  1. Go to: Acquisition and then Traffic Acquisition and then Session Source/Medium.
  2. Choose the filter for dbm / cpm.
When you link Google Analytics with Display & Video 360, you're sharing conversion data. This conversion data is only available in Display & Video 360 through custom bidding metrics reporting.

Google Analytics 4 sample scripts

Using weighted conversions

You can optimize toward your most valuable conversions by using weighted conversions.

Sample script

Given 3 conversion types: a newsletter sign-up, a one-time purchase, and a subscription purchase.

The following sample script assigns the following conversion values:

  • Subscription purchase has a weight of 10. (most-valued conversion)
  • Newsletter sign-up has a weight of 2.
  • One-time purchase has a weight of 1. (least-valued conversion)
Property ID Conversion event name
123 one_time_purchase
124 newsletter_signup
125 subscription

return sum_aggregate([

  ([ga4_conversions_count(123, "one_time_purchase")>0], 1),    #one-time purchase

  ([ga4_conversions_count(124, "newsletter_signup")>0], 2),    #newsletter sign-up

  ([ga4_conversions_count(125, "subscription")>0)], 10)   #subscription purchase

])

Weighted conversion using a combination of Google Analytics events

You can score ad impressions that lead to different conversion events to optimize toward users that trigger certain events. 

Sample script

Using the following GA4 property ID and Conversion event name, the following sample script optimizes toward the most valuable event by using weighted conversions.

GA4 property ID Conversion event name
123 landing_page
124 application_start
125 application_summary
126 application_complete

return max_aggregate([

  ([ga4_conversions_count(123, “landing_page”)], 1),        #least valued

  ([ga4_conversions_count(124, “application_start”)], 5),   

  ([ga4_conversions_count(125, “application_summary”)], 7),

  ([ga4_conversions_count(126, “application_complete”)], 9)  #most valued

])

Optimizing toward a transaction value

You can optimize toward a specified transaction value by scoring impressions based on the actual value of the purchase to maximize your ROAS using Google Analytics 4 properties.

You can assign a $100 purchase a score of 100, while a $10 purchase scores 10.

return ga4_conversions_total_value(property_id, conversion_event_name)

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