Integrate Google Analytics 4 and Demandbase Using the Page View Event

  • Updated

Context

The Demandbase Tag sends Company Profile Attributes to Custom Dimensions in Google Analytics 4 (GA4). The Demandbase One integration lets you add Demandbase Firmographics to your Google Analytics (GA) account and enables a richer B2B view of what’s happening with visits to your website.

There are two methods you can use to set up the Demandbase integration with GA4. The method covered in this article sends data from Demandbase custom dimensions through the GA4 page view event as user parameters. This is the recommended method to set up the integration because it provides more metrics for custom reporting in GA4.

The other method you can use sends data through a Demandbase custom event. The set up for this  method is less complex, but it provides limited custom reporting in GA4. This method allows you to see which accounts visited a page and how many times they visited, but doesn’t allow you to associate Demandbase data to all the other custom events collected in GA4. To use this method, see Integrate Google Analytics 4 and Demandbase Using a Custom Event.

Important:

  • Google replaced Universal Analytics with GA4 in July 2023 (see the Google documentation). To maintain GA reporting continuity with Demandbase data, set up the Demandbase integration with GA4.
  • The Demandbase integration with GA4 is separate from an integration with a Universal Analytics property. Any current integrations set up with a Universal Analytics property will not be affected by a new integration set up with a GA4 property.
  • If you have an integration set up with Universal Analytics, you can skip to Step 5: Grant Demandbase Access to GA to set up a new integration with GA4.

Prerequisite/Preparation

You must have Google Analytics Admin permissions.

Step 1: Ensure the Demandbase Tag is Deployed

If you have not deployed the Demandbase Tag to your website, see Deploy Demandbase One Tag.

Step 2: Ensure You Have GA4 and Google Tag Manager (GTM)

See the Google documentation to see if you are using GA4 and GTM.

Tip: An integration with Google Universal Analytics can be used at the same time as an integration with GA4. See Integrate Google Analytics with Demandbase to set up an integration with a Universal Analytics property.

Step 3: Select the Demandbase Attributes to Capture

Demandbase provides you with over 40 firmographic attributes you can use to collect data about the company traffic coming to your site. We recommend starting with the following 12 attributes in GA4.

  1. Company ID
  2. Company Name
  3. Website
  4. Industry
  5. Sub Industry
  6. Employee Band
  7. Revenue Band
  8. Audience
  9. Audience Segment
  10. City
  11. State
  12. Country Name

For details on each firmographic attribute, see Reference: Firmographic Attributes Overview for Demandbase IP-API v3 (Updated Version).

Tip: You can also add account-level Demandbase fields that you want to collect data for, including CRM account-level fields. To access Demandbase fields, go to Settings_N.png Settings > Analytics > Fields. For more information about Demandbase fields, see Understanding Fields

Step 4: Add the Selected Attributes to Account Connector

  1. In Demandbase, from the left navigation bar, go to Settings_N.png Settings > Demandbase-Wide Settings > Account Connector and click Create New Integration.
  2. In the window that opens, select Google Analytics 4 from the Integration Name drop-down list and click Create.
    GA4
  3. In the window that opens, enter your Google Measurement ID and click Next. See the Google documentation for more information about your measurement ID.
    GA4
  4. On the Google Analytics 4 page, add or remove attributes to capture in the Field Configurations table. By default, Demandbase pre-populates the table with the 12 recommended attributes listed in Step 3.
    • To add an attribute, click Add Field at the bottom of the table and enter the Data Field.
    • To remove an attribute you added, hover over the field name, click the gear icon that appears, and click Delete Field.
      Important: You cannot remove the 12 pre-populated attributes.
  5. Click Activate to activate the integration and to generate the Data Layer Variable Name for each attribute in the Field Configurations table.
    Tip: Click the three dots next to the Activate button to make edits to the integration such as updating fields.
    GA4 Activate 2.png

Important:

  • Activating the integration only enables the selected attributes to return data as part of the API call from the Demandbase Tag. It does not pass data to GA until the integration setup is complete.
  • If you make changes in Account Connector after the initial setup, contact your CSM to update and reactivate the integration. The integration Status remains as Processing until Demandbase completes the process.

Step 5: Grant Demandbase Access to GA

Set up Demandbase with edit access to your GA4 property using demandbase.analytics21@gmail.com. If no access can be granted, you’ll need to complete Step 6 through Step 9 without assistance from Demandbase or on a call with a member of the Demandbase Implementation team.

Important: After granting Demandbase access, contact your Demandbase Account Team to complete the integration setup and to validate data flow between Demandbase and GA.

Step 6:  Set Up GTM Variables

  1. Sign in to GTM and navigate to the GTM container with the GA4 property setup.
  2. In the Workspace, select Variables from the left menu.
  3. Create a new variable for each Demandbase attribute selected in Step 4.
    Variable_Config.png
    In the Variable Configuration window, enter the following:
    • Name: Enter a variable name at the top of the page.
    • Variable Type: Select Data Layer Variable.
    • Data Layer Version: Select Version 2 with a default value of Non-Company Visitor.
    • Data Layer Variable Name: Each variable requires a specific name from the Demandbase API response. Enter the following for the Demandbase attributes in Step 4.
      • company_id
      • company_name
      • web_site
      • industry
      • sub_industry
      • employee_range
      • revenue_range
      • audience
      • audience_segment
      • city
      • state
      • country_name
        Tip: For the data variable names to use with other firmographic attributes, see the Data Layer Variable Name column for each attribute select in the Account Connector Google Analytics 4 page in Step 4.

Step 7: Add Demandbase Variables to the Existing Google Tag

  1. In the GTM container, select Tags from the left menu.
  2. Locate your domain’s existing Google Tag, which is used to fire the GA4 page view event (previously known as the GA4 Configuration Tag).
    Step 7_2.png
  3. In the Tag Configuration window, expand the Shared event settings section and select New Variable in the Event Settings Variable field.
    Step 7_3.png
  4. Add the Demandbase variables to the Variable Configuration as follows:
    • Variable Label: Add a name for the group of variables at the top left (for example,. Demandbase Variables)
    • Google Analytics User Properties: Add a property row for each GTM variable created for the Demandbase attributes in Step 6. 
      • In the Property Name field, enter a user property name for each custom Demandbase variable created in Step 6. The recommended names for each attribute are provided below.
        Important: You can use any property name, but the names entered here must match the user property name you create in GA4 in Step 9 . 
        • db_company_id
        • db_company_name
        • db_website
        • db_industry
        • db_sub_industry
        • db_employee_range
        • db_revenue_range
        • db_audience
        • db_audience_segment
        • db_city
        • db_state
        • db_country_name
      • In the Value field, click the plus icon and select the corresponding GTM variable created for each Demandbase attribute in Step 6.
        The following screenshot shows an example of the resulting variable configuration.
        Step 7_4.png
  5. Click Save to save the variable configuration. The configuration appears in the Event Settings Variable field.
    Step 7_5.png
  6. Go to the Advanced Settings section and select Once per page in the Tag firing options field.
    Step 7_6.png

Step 8: Update Google Tag Trigger

To ensure that Demandbase data is available before the GA4 page view event fires, we need to update the Google Tag trigger to provide sufficient time for the data to be available. 

Important: If your Google Tag trigger is currently based on a consent manager policy or if you have questions about changing the timing of your existing Google Tag trigger, contact your Demandbase Account Team. The team can assist and provide instructions on how to specifically update your Google Tag trigger.

  1. In the Google Tag updated in step 7, remove any existing triggers.
  2. Create a new trigger named Demandbase_Loaded and select the Custom Event in the Trigger Type field.Trigger_Config.png
  3. In the Trigger Configuration window, enter the following:
    • Event name: Enter Demandbase_Loaded.
    • The trigger fires on: Select All Custom Events.
  4. Save the Demandbase Loaded trigger.
  5. Create a second new firing trigger with and select Timer in the Trigger Type field.
  6. Enter GA4 Timer for the trigger label.
  7. In the Trigger Configuration window, enter the following:
    • Event Name: Enter gtm.timer.
    • Interval: Enter 2500.
    • Limit: Enter 1.
    • Under Enable this trigger when all of these conditions are true, enter Container ID, contains, and your GTM Container ID. The following screenshot shows GTM-Demo as the GTM Container ID.
      Tip: The GTM Container ID can be found in your GTM workspace, near the top of the window, formatted as GTM-XXXXX.
      Step 8_7.png
  8. Click Save to save the second trigger. After you create and save both triggers, they appear at the bottom of your GA4 Google Tag (page view event).
    Step 8_8.png

Step 9: Set Up Custom Dimensions in GA4

In GA, set up Custom Dimensions to match your Account Connector mapping for Google Analytics in Demandbase.

  1. Sign in to GA and navigate to the appropriate GA4 Property.
  2. In the Admin section, expand Data display and click Custom definitions.
    Step 9_2 new.png
  3. On the Custom dimensions tab, click Create custom dimensions. Create a custom dimension for each Demandbase attribute selected in Step 4.
    Step 9_3.png
    In the New custom dimension window, enter the following:
    • Dimension name: Enter a name for the dimension to reference the Demandbase attribute. For example, Demandbase - Company Name.
    • Description: (Optional) Enter a description to add more details for the dimension.
    • Scope: Select User for all dimensions.
    • User property: This is the most important field when you create custom dimensions. Ensure the values entered match the value used in step 7. We recommend adding demandbase or db to the user property name. For example, enter the following for attributes recommended in Step 3.
      • db_company_id 
      • db_company_name
      • db_website
      • db_industry
      • db_sub_industry
      • db_employee_range
      • db_revenue_range
      • db_audience
      • db_audience_segment
      • db_city
      • db_state
      • db_country_name

Was this article helpful?

1 out of 1 found this helpful