Integrate Google Analytics 4 and Demandbase Using a Custom Event

  • Updated


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 through a Demandbase custom event. The setup 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.

The other method you can use 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. It allows you to associate Demandbase data to other custom events collected in GA4. To use this method, see Integrate Google Analytics 4 and Demandbase Using the Page View Event.


  • 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 6: Set Up Custom Dimensions to set up a new integration with GA4.


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. Within GA4, you can set up as many as 50 event-scoped custom dimensions. 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: Firmographics Attributes Overview for Demandbase IP-API (Updated V3 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.
  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.
  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


  • 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 If no access can be granted, you’ll need to complete Step 6 through Step 9 without assistance from Demandbase.

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 Custom Dimensions

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. Click the Configure icon in the left menu and click Custom definitions.
  3. Click Create custom dimensions. Create a custom dimension for each Demandbase attribute selected in Step 4.
    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 Event for all dimensions.
    • Event Parameter: This is the most important field when you create custom dimensions. Enter a name to be used to complete the integration in GTM. We recommend adding demandbase or db to the event parameter name. For example, enter the following for attributes recommended in Step 3.
      • demandbase_company_id
      • demandbase_company_name
      • demandbase_website
      • demandbase_industry
      • demandbase_sub_industry
      • demandbase_employee_range
      • demandbase_revenue_range
      • demandbase_audience
      • demandbase_audience_segment
      • demandbase_city
      • demandbase_state
      • demandbase_country_name

Step 7:  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.
    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 8: Create a New GA4 Event

  1. In the GTM container, select Tags from the left menu.
  2. Create a new tag with the name Demandbase GA4 Event and select the Google Analytics: GA4 Event tag type.
  3. In the Tag Configuration window, enter the following.
    • Configuration Tag: Add the GA4 property that Demandbase will send data to.
    • Event Name: Enter Demandbase_Event.
    • Event Parameters: Add a row for each GTM variable created for Demandbase attributes in Step 7.
      • In the Parameter Name field, enter the event parameter name for each custom dimension created for Demandbase attributes in Step 6. The names entered must match the event parameter name.
      • In the Value field, click the plus icon and select the corresponding GTM variable created for each Demandbase attribute in Step 7.

Step 9: Update the Demandbase GA4 Event Trigger

For the Demandbase GA4 Event tag created in Step 8, update the trigger to ensure that Demandbase data is available before firing the GA4 event.

  1. In the Demandbase GA4 Event tag, create a new trigger with the name Demandbase_Loaded and select the Custom Event trigger type.Trigger_Config.png
  2. In the Trigger Configuration window, enter the following:
    • Event name: Enter Demandbase_Loaded.
    • The trigger fires on: Select All Custom Events.

Was this article helpful?

3 out of 7 found this helpful