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.
2. Click “Create Event” and choose the correct data stream.
3. Set up your event so that the custom event name and value are the same and match the lead status (ex: diq_lead).
4. Set up a custom event for each lead status: visitor, lead, qualified lead, disqualified lead, appointment, utility bill.
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:
- Sign in to your Google Analytics account.
- Click Admin.
- Expand Property Settings.
- In the Property Settings dropdown, click the Data Collection and Modification dropdown.
- Click Data Streams under the Data Collection and Modification dropdown.
- Click the data stream for your website.
- Under Google tag, click View tag instructions.
- 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>
- 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:
- 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:
- Sign in to your Google Analytics account.
- Click Admin.
- Expand Property Settings.
- In the Property Settings dropdown, click the Data Collection and Modification dropdown.
- Click Data Streams under the Data Collection and Modification dropdown.
- Click the data stream for which you need the ID.
- In the Google tag section, click Configure tag settings.
- 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:
- Sign in to your Google Analytics account.
- Click Admin.
- Expand Property Settings.
- In the Property Settings dropdown, click the Data Collection and Modification dropdown.
- Click Data Streams under the Data Collection and Modification dropdown.
- Click the data stream you want to generate an API Secret for.
- Find Measurement Protocol API secrets and click Create.
- Copy your new API secret to a new note or document
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.
UTM parameter tracking in GA4 is currently not supported by Demand IQ Portal. Our Engineering team is working hard to enable this capability.