Google Analytics: Connect Demand IQ to GA4

Learn how to report Demand IQ conversions as Custom Events in GA4

Google Analytics 4 support is now offered in Stella using Custom Events. In short, any new or updated lead status in Demand IQ can be reported in GA4. 

Make sure you have a GA4 property!

Your GA4 property will be formatted like G-XXXXXXX. You cannot use a Universal Analytics property for the following setup. Universal Analytics properties are formatted like UA-000000-4.

Step 1: Create Events in GA4

You'll need to create events for each Demand IQ lead status you'd like to track in Demand IQ. Your six options for lead statuses are:

  • Visitor
  • Lead
  • Qualified Lead
  • Disqualified Lead
  • Appointment
  • Utility Bill

1. On your Google Analytics homepage, click “Admin” -> "Data Display" -> “Events” in under your GA4 Property.

Screenshot 2023-11-03 at 1.02.21 PM

2. Click “Create Event” and choose the correct data stream.

Screenshot 2023-08-16 at 12.45.22 PM

3. Set up your event so that the custom event name and value are the same and match the lead status (ex: diq_lead).

Screenshot 2023-08-16 at 12.46.55 PM

4. Set up a custom event for each lead status: visitor, lead, qualified lead, disqualified lead, appointment, utility bill.

Screenshot 2023-08-16 at 12.54.49 PM

You can use existing GA4 events created for other conversions if you'd like, however this might make your reporting more complicated. We recommend creating Demand IQ-specific conversion events.

Step 2: Place GA4 Snippet in Demand IQ

Copy your GA4 tracking snippet from within Google Analytics: 

  1. Sign in to your Google Analytics account.
  2. Click Admin.
  3. Expand Property Settings.
  4. In the Property Settings dropdown, click the Data Collection and Modification dropdown.
  5. Click Data Streams under the Data Collection and Modification dropdown.
    Screenshot 2023-11-03 at 1.08.44 PM
  6. Click the data stream for your website.
  7. Under Google tag, click View tag instructions.
  8. On the Installation instructions page, select Install manually:
    • On the screen, you’ll see the JavaScript snippet for your account's Google tag. Copy your Google tag is the entire section of code that appears, beginning with:
      <!-- Google tag (gtag.js) -->
      and ending with
      </script>
  9. Paste you Google Tag in your Demand IQ Portal > Configurator > Integration > Custom HTML Tags. 

Don't see a Data streams option in the Property column?

You have a Universal Analytics property instead of a GA4 property. Please create a GA4 property and begin from Step 1. 

Step 3: Get Google tag ID

To find your Google tag ID (which usually starts with "G-"), do the following:

  1. Sign in to your Google Analytics account.
  2. Click Admin.
  3. Expand Property Settings.
  4. In the Property Settings dropdown, click the Data Collection and Modification dropdown.
  5. Click Data Streams under the Data Collection and Modification dropdown.
    Screenshot 2023-11-03 at 1.08.44 PM
  6. Click the data stream for which you need the ID.
  7. In the Google tag section, click Configure tag settings.
  8. In the Your Google tag section, copy the ID that starts with "G-" to a note or document. 

Step 4: Get New API Secret

To create a new secret:

  1. Sign in to your Google Analytics account.
  2. Click Admin.
  3. Expand Property Settings.
  4. In the Property Settings dropdown, click the Data Collection and Modification dropdown.
  5. Click Data Streams under the Data Collection and Modification dropdown.
  6. Click the data stream you want to generate an API Secret for.
  7. Find Measurement Protocol API secrets and click Create.
  8. Copy your new API secret to a new note or document

Screen Shot 2023-04-04 at 3.00.03 PM

Step 5: Add Event Codes in Demand IQ Portal

Copy this code snippet, replacing the following:

  • {GTAG ID} with your Google tag ID
    • ex: G-A1B2C3D4E
    • Appears in two places in snippet
  • {API Secret} with your API secret key
    • ex: eFfm71mRer-23kRfd9
    • Appears in one place in snippet
  • {EVENT_NAME} with your event's name from GA4
    • ex: diq_visitor
    • Appears in one place in snippet
    • Note: This value should change for each lead status.

You will use the same Google Tag ID and API secret key for each lead status snippet.

<script>
gtag('get', '{GTAG-ID}', 'client_id', (client_id) => {
console.log(client_id+' Client ID for DIQ GA4 integration');
fetch(`https://www.google-analytics.com/mp/collect?measurement_id={GTAG-ID}&api_secret={API-SECRET}`, {
  method: "POST",
  body: JSON.stringify({
    client_id: client_id,
    events: [{
    name: '{EVENT_NAME}',
      params: {},
    }]
  })
});    
});
</script>

Paste your updated code snippets inside the correspond lead status' Custom Code section in Demand IQ Portal > Configurator > Integration.

Screen Shot 2023-04-04 at 3.12.35 PM

UTM parameter tracking in GA4 is currently not supported by Demand IQ Portal. Our Engineering team is working hard to enable this capability.