Capture Google Analytics Client ID in HubSpot

For vacation rental businesses using HubSpot CRM, capturing the Google Analytics Client ID creates a powerful connection between anonymous website behavior and identified contacts.
What is the Client ID?
The GA Client ID is a unique identifier assigned to each visitor. By capturing this in HubSpot, you can connect a contact's entire website history to their CRM record.
This enables you to answer questions like:
- Which blog posts did this lead read before booking?
- What was their first touchpoint with our brand?
- How many times did they visit before converting?
Implementation Steps
Step 1: Form Setup
Create form fields (visible or hidden) to receive Client ID data. Hidden fields work best for seamless user experience.
Step 2: Variable Creation
Use Google Tag Manager's Custom JavaScript to extract the Client ID:
function() {
return ga.getAll()[0].get('clientId');
}
Step 3: Form Population
Insert a custom HTML tag that assigns the captured ID to designated form fields. This fires before form submission to ensure the data is included.
Step 4: Trigger Configuration
Set Page View triggers (Window Loaded) to fire on specific pages containing forms. This ensures the Client ID is captured as soon as possible.
Step 5: HubSpot Integration
Create custom contact properties in HubSpot matching form field names for automatic data synchronization:
- Property name:
ga_client_id - Field type: Single-line text
- Auto-population: From form field
Using the Data
Once captured, you can:
- Send to advertising platforms - Upload as offline conversions to Google Ads, Facebook
- Build segments - Create lists based on website behavior patterns
- Personalize outreach - Reference pages they visited in your emails
- Attribution reporting - Connect revenue to original traffic sources
Marketing Attribution Benefits
With Client ID capture, you can trace every booking back to the original marketing touchpoint—whether that was a Google ad, organic search, or social media post weeks or months ago.
This level of attribution helps you:
- Optimize marketing spend across channels
- Understand the true customer journey
- Calculate accurate ROI for each campaign
- Make data-driven budget decisions
Additional Resources
Check out the video tutorial for a step-by-step walkthrough of the implementation.
Credit to Mixed Analytics for the implementation code referenced in this guide.
Want to dive into your booking analytics and uncover what drives bookings?
Get StartedNewsletter
Get hosting tips in your inbox
Strategies, trends, and insights. No spam.