Google Analytics with Hubspot Forms

You must first add the Roadway tag

1. Add Roadway Tag

Add the following script tag to the <head> section of your website or on Google Tag Manager to All Pages:

<script defer src="//analytics.roadwayai.com/tag.js"></script>

Complete ID mapping

Hubspot Forms

Choose your CRM provider


Hubspot

Choose your Google Analytics implementation method:


Google Analytics

If you have Google Analytics 4 implemented directly on your website, you’re all set! The tag will automatically send HubSpot form submissions to GA4.


Google Tag Manager

If you’re using Google Tag Manager, you need to add a custom event and variable. You can skip all the instructions below and we can do it for you (if you prefer)


Have Roadway add event and variable:

📌 This is for Google Tag Manager only.

  1. In Admin, under the Account column, click User Management.

  2. In the User Management panel, click the + button, then click Add users.

  3. Enter service@roadwayai.com in the email field.

  4. Select Notify new users by email to send an invitation to the user.

  5. Assign the following permissions:

    • Account Permissions: Choose User or Administrator as needed.

    • Container Permissions: Select Publish for the relevant container(s).

  6. Click Invite to send the invitation.


Add event and variable myself:

  • Create and configure Custom Event Trigger:

    1. Click on "Triggers" in the left-hand menu.

    2. Click "New".

    3. Name your trigger Roadway Custom Event - hubspot_form_submission on the top left

    4. Click on "Trigger Configuration".

    5. Select "Custom Event".

    6. In the "Event Name" field, enter hubspot_form_submission.

    7. Choose "All Custom Events".

    8. Click "Save" to finalize the trigger.

  • Create the hubspot_utk Variable:

    1. Go to "Variables", Click "New".

    2. Select "Data Layer Variable", Name it DL - hubspot_utk on the top left

    3. Set the "Data Layer Variable Name" field to hubspot_utk.

    4. Save the variable.

  • Create and configure GA4 Event Tag:

    1. In GTM, click on "Tags" in the left-hand menu.

    2. Click "New", Name your tag Roadway GA4 - HubSpot Form Submission.

    3. Click on "Tag Configuration".

    4. Select "Google Analytics: GA4 Event".

    5. In the "Configuration Tag" dropdown, select your existing GA4 Configuration tag.

      1. If you don’t have one, set it up first by inputting your Measurement ID.

    6. In the "Event Name" field, enter the exact name of your custom event: hubspot_form_submission.

    7. Scroll down to the "Event Parameters" section, Click "Add Row" to add two new parameters.

      Parameter Name

      Value

      hubspot_utk

      {{DL - hubspot_utk}}

    8. Click on "Triggering", select the custom event trigger Roadway Custom Event - hubspot_form_submission.

    9. Click "Save", submit and publish the GTM container.

Salesforce

Google Analytics/Tag Manager/Segment (JS embed)

If you’re using Salesforce for your CRM, you need to add a hidden field, custom property, and map those in your integration. Roadway tag will take care of the rest. You can skip all the instructions below and we can do it for you (if you prefer).


Have Roadway add hidden field, property, and mapping for me:

📌 This is for Salesforce only.

  • In Setup, under the Administration section, click Users.

  • In the Users panel, click the New User button, enter service@roadwayai.com in the email field.

  • Check Generate new password and notify user immediately to send an email invitation to the user.

  • Set the following permissions:

    • Profile: Choose System Administrator access level.

    • Role: Assign an appropriate role if your organization uses roles.

  • Click Save to create the user account and send the invitation.


Add hidden field, property, and mapping myself:

  • Create Hubspot contact Property:

    • Log into HubSpot and select account "Settings" from the dropdown menu.

    • In the left sidebar menu, go to "Properties" under the "Data Management" section.

    • Click the "Create property" button in the upper right corner.

    • Configure Property Details:

      • Object Type: Select "Contact" to ensure the property is associated with contact records.

      • Group: Choose an existing property group (e.g., "Contact Information") or create a new group to organize your properties.

      • Label: Enter ga4_pseudo_user_id as the property name.

      • Field Type: Select "Single-line text" to match the Salesforce "Text" field type.

    • Save the Property: After verifying the details, click "Create" to finalize the new contact property.

  • Add Hidden Field to HubSpot Form:

    1. Log into HubSpot, navigate to your Forms

    2. Click on the "Edit" button for the form(s) you want to edit

    3. On the "existing fields" section, search for and add the ga4_pseudo_user_id contact property you just created

    4. On the new ga4_pseudo_user_id input field, click on the "Edit" button and click the "Make this field hidden" box

    5. Click the "Update" button in top right corner

    For details, see HubSpot Forms Guide.

  • Create Salesforce contact Property:

    1. Log into Salesforce and enter the Setup menu.

    2. Navigate to Object Manager and select the "Contact" object.

    3. Click "Fields & Relationships" then select "New."

    4. Choose "Text" as the field type and set the field label to ga4_pseudo_user_id.

    5. Specify the field length to 255.

    6. Confirm the settings and click "Next."

    7. Click "Next" again on step 3 "Establish field-level security".

    8. Click "Save" on step 4 "Add to page layouts".

    Detailed instructions are available in the Salesforce Custom Field Guide.

  • Map HubSpot contact field to Salesforce contact field:

    1. Navigate to your HubSpot account settings.

    2. Click on "Integrations" and select "Salesforce."

    3. Confirm that "contact created or updated in (hubspot) -> create or update the contact (in salesforce)

    4. Navigate to Contacts property mappings

    5. Under the "Field Mappings" section, click select "Add new field mapping”

    6. Select ga4_pseudo_user_id from the HubSpot form fields list and map it to ga4_pseudo_user_id in Salesforce contact properties.

    7. Click "Save" to apply the mapping.

    Guidance can be found here: HubSpot-Salesforce Integration Field Mapping.

Last updated