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:
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.
In Admin, under the Account column, click User Management.
In the User Management panel, click the + button, then click Add users.
Enter service@roadwayai.com in the email field.
Select Notify new users by email to send an invitation to the user.
Assign the following permissions:
Account Permissions: Choose User or Administrator as needed.
Container Permissions: Select Publish for the relevant container(s).
Click Invite to send the invitation.
Add event and variable myself:
Create and configure Custom Event Trigger:
Click on "Triggers" in the left-hand menu.
Click "New".
Name your trigger
Roadway Custom Event - hubspot_form_submission
on the top leftClick on "Trigger Configuration".
Select "Custom Event".
In the "Event Name" field, enter
hubspot_form_submission
.Choose "All Custom Events".
Click "Save" to finalize the trigger.
Create the hubspot_utk Variable:
Go to "Variables", Click "New".
Select "Data Layer Variable", Name it
DL - hubspot_utk
on the top leftSet the "Data Layer Variable Name" field to
hubspot_utk
.Save the variable.
Create and configure GA4 Event Tag:
In GTM, click on "Tags" in the left-hand menu.
Click "New", Name your tag
Roadway GA4 - HubSpot Form Submission
.Click on "Tag Configuration".
Select "Google Analytics: GA4 Event".
In the "Configuration Tag" dropdown, select your existing GA4 Configuration tag.
If you don’t have one, set it up first by inputting your Measurement ID.
In the "Event Name" field, enter the exact name of your custom event:
hubspot_form_submission
.Scroll down to the "Event Parameters" section, Click "Add Row" to add two new parameters.
Parameter Name
Value
hubspot_utk
{{DL - hubspot_utk}}
Click on "Triggering", select the custom event trigger
Roadway Custom Event - hubspot_form_submission
.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:
Log into HubSpot, navigate to your Forms
Click on the "Edit" button for the form(s) you want to edit
On the "existing fields" section, search for and add the
ga4_pseudo_user_id
contact property you just createdOn the new
ga4_pseudo_user_id
input field, click on the "Edit" button and click the "Make this field hidden" boxClick the "Update" button in top right corner
For details, see HubSpot Forms Guide.
Create Salesforce contact Property:
Log into Salesforce and enter the Setup menu.
Navigate to Object Manager and select the "Contact" object.
Click "Fields & Relationships" then select "New."
Choose "Text" as the field type and set the field label to
ga4_pseudo_user_id
.Specify the field length to 255.
Confirm the settings and click "Next."
Click "Next" again on step 3 "Establish field-level security".
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:
Navigate to your HubSpot account settings.
Click on "Integrations" and select "Salesforce."
Confirm that "contact created or updated in (hubspot) -> create or update the contact (in salesforce)
Navigate to Contacts property mappings
Under the "Field Mappings" section, click select "Add new field mapping”
Select
ga4_pseudo_user_id
from the HubSpot form fields list and map it toga4_pseudo_user_id
in Salesforce contact properties.Click "Save" to apply the mapping.
Guidance can be found here: HubSpot-Salesforce Integration Field Mapping.
Last updated