How to create a lead scoring model with Marketo, Google Analytics, and AudienceStream

This article explains tow to create a lead scoring model with Marketo, Google Analytics, and AudienceStream.


  • Tag Vendor
    Google Analytics (Universal) + Google Measurement Protocol

  • Use Case
    Push Lead Scoring from AudienceStream to Google Analytics

  • Key Attributes

    • Lead Score (Number)
      Number based on custom event interactions. This value is initialized to zero for a new visitor. It is then incremented/decremented based on that visitor’s interactions with specific assets on the client’s website.
    • Visitor Value (String)
      String based on Lead Score value. This value is initialized to Standard Visitor for a new visitor. That visitor can then be upgraded to a High Value Visitor after crossing a specified Lead Score threshold. In addition, that visitor can fall back to a Standard Visitor if their Lead Score drops below that threshold. In this use case, there are only 2 initial values but more can be added to create more stratification between visitors.
  • Use Case
    Trigger a GET URL call to Google Analytics to identify if a visitor is a Standard Visitor or a High Value Visitor based on the audience that their Lead Score puts them in. This process leverages the Google Analytics Measurement Protocol to submit the data.

  • Sample Scenario
    The audiences requested to be created are tied to elements from a sample client’s scoring model that is built within Marketo, their Marketing Automation platform. The Marketo scoring model gives points for each event that a visitor triggers which then increments their MQL (Marketing Qualified Lead) score in Marketo. By capturing those same events in AudienceStream to create audiences, we can then enrich Google Analytics by submitting the values to custom dimensions. These custom dimensions can then be used passively for lookback analysis of browsing behavior or actively by using them to build remarketing lists in Google Analytics and importing them into Google Ads for advertising purposes within the Google Display Network.

Step 1: Get the Google Analytics Visitor ID (Tealium iQ)

In order for Google Analytics to properly store the hit from the Webhook, the Google Analytics Visitor ID must be provided in the Webhook. This is done in Tealium iQ by parsing the cookie _ga using a Set Data Values extension and storing the 2 longest numbers at the end of the cookie value into a data layer variable. Declare _ga as type First Party Cookie, and google_visitorid as type UDO Variable in your Data Layer tab. Then create the Set Data Values extension as seen below.

See the following code and screenshot example:

Google Analytics Visitor ID

The google_visitorid value can then be stored as a a string.

set string to google visitorid

We will set a Boolean to check if the data exists. This is important because the value stored in google_visitorid is required for Google Analytics to save the data received from the connector.

set boolean google visitor id

Last, we will eventually map the data to the cid parameter in the Webhook that we build for Google Analytics

map to cid

Step 2: Capture event information (Tealium iQ)

Configure the events in Tealium iQ that will adjust the Lead Score metrics in AudienceStream. This usually involves calling on specific website assets when they are clicked on or interacted with. For this step, you’ll have the option to use the jQuery onHandler() extension or a JavaScript Code extension to capture these events. These will both submit the data Google Analytics and AudienceStream.

For this use case, we’ve chosen to use the Javascript Code extension and used jQuery to capture all the events. Some examples of positive events from this use case are interactions with assets like case studies, white papers, videos, webinars, and more. It also includes negative events, such as Support, which will negatively impact Lead Score by either decrementing the value or resetting it to zero.


Step 3: Create rules and attributes (AudienceStream)

Lead Score

Initialize Lead Score to zero for all new visitors. This is done by using the Lifetime Event Count Number and checking if it is zero.

lead score lifetime

For all events with positive points, increment the Lead Score by a desired value.

increment decrement lead score

For all negative events, apply the negative credit however it fits the model. In the case of Support, it resets the score to zero.

lead score support user

If the scoring model is still being refined (as in this use case), make sure to use small values initially so that when you end up refining the model with higher values, visitors with initial lower lead score values do not skew your audiences.


Lead Score > 3 or Lead Score >= 3. These will be used to assign the Visitor Value String next.

LS greater equal 3

Visitor Value

For this use case, the initial critical Lead Score threshold is 3. If Lead Score is less than 3, then set to Standard Visitor. If Lead Score is greater or equal to 3, then set to High Value Visitor.

string visitor value

Step 4: Create audiences (AudienceStream)

High Value Visitors

When Visitor Value is High Value Visitor, visitor is a member of this audience.

high value audience

Standard Visitors

When Visitor Value is Standard Visitor, visitor is a member of this audience.

Standard audience

Step 5: Configure webhook (Google Analytics and AudienceStream)

Custom Dimensions

Create Custom Dimensions in Google Analytics that the Webhook will populate.

Custom dimensions

Webhook Example

The following example configuration is used to trigger the data to Google Analytics.

Google Analytics Configurations

Required parameters

The following table lists the primary fields that should be populated so the data can be saved correctly in Google Analytics.

While t and ni are not required based on Google’s documentation, they should be set to event and 1 respectively so that the Webhook does not impact bounce rate or inflate page views.

Field Description
t=event This identifies the hit type. This can be a page view or an event. It’s probably best to use an event so that page views are not inflated since no page is actually being seen.
cid=12345.6789 This is the visitor ID parsed by Tealium iQ.
tid=UA-12345-1 This is the Google Analytics Account Number.
v=1 This indicates version 1 of the Google Measurement Protocol.
ni=1 This identifies if the hit will be a non-interaction event. By setting it to 1, we don’t affect bounce rate.

Optional Parameters

The following table lists parameters that are not required, but will provide additional context in Google Analytics on how to isolate the Webhook events from other events captured by Google Analytics.

Field Description
ec=ASConnector Event Category Name
ea=VisitorValue Event Action Name
el=StandardVisitor Event Label Name
dp=/webhook/ Document path
dt=Webhook Document title

AudienceStream dynamic parameters

For this use case, the following values are populated from the attributes that were previously configured.

Field Description
cd1=id:123-ABC-456& Custom dimension 1 value. In this scenario, it is theMarketoID.
cd2=StandardVisitor Custom dimension 2 value. In this scenario, it is the Visitor Value which is either Standard Visitor or High Value Visitor.


There will be 2 connectors configured. Each one will fire based on when a visitor joins or changes audiences from Standard Visitor or High Value Visitor.

Two Connectors

Every new visitor will fire the connector on their first pageview to flag them as a Standard Visitor. This first connector must fire because Google Analytics does not automatically assign a NULL value to custom dimensions. If you need a default value in a custom dimension, it must be populated with some value. If they eventually join the High Value Visitor audience, a second connector will fire to upgrade them to a High Value Visitor. If that visitor ever leaves that audience and re-joins the Standard Visitor audience, the connector will fire again.

Step 6: Act!

Example: Custom report

Custom report

Example: Remarketing list based on High Value Visitor

Remarketing list

Google Analytics can now be integrated with your existing Display Ad campaigns to target your visitors.

Was this page helpful?

This page was last updated: January 7, 2023