Skip to content

HubSpot Setup

John Williams edited this page Mar 11, 2026 · 1 revision

HubSpot Setup Guide

HubSpot has two complementary approaches. Use both for maximum coverage.


Option A — Native Google Ads Integration (Primary)

  1. HubSpot → SettingsIntegrationsGoogle Ads
  2. Connect your Google Ads account
  3. Select conversion events to track (form submissions, meetings booked, etc.)
  4. HubSpot will automatically sync these as offline conversions to Google Ads

This works without any GCLID scripting. It uses HubSpot's own tracking.


Option B — GCLID Script (Multi-Page Journey Fallback)

HubSpot's URL pre-population only works when the user lands directly on the form page. If the user:

  • Clicks an ad → goes to homepage → navigates to contact page → fills form

...the GCLID is lost. The script in this repo solves this with localStorage persistence.

Setup

1. Create GCLID contact property

  • Settings → Properties → Contact Properties → Create
  • Type: Single-line text
  • Label: GCLID
  • Internal name: gclid__c

2. Add hidden field to forms

  • Form editor → Add field → Hidden → select GCLID property
  • Check: Pre-populate from URL parameter: gclid

3. Deploy scripts/hubspot.js via GTM

  • Update FIELD_MAP with your HubSpot property internal names
  • Trigger: All Page Views

Finding Property Internal Names

HubSpot → Settings → Properties → Contact → click a property → copy Internal name

Standard HubSpot analytics properties:

  • hs_analytics_source — traffic source
  • hs_analytics_source_data_1 — UTM medium
  • hs_analytics_source_data_2 — UTM campaign

Custom properties typically end in __c by convention.


Troubleshooting

Issue Fix
GCLID not populating Field name mismatch — check FIELD_MAP vs internal name
URL pre-pop not working User didn't land directly on form page — script handles this
HubSpot integration not importing Re-authenticate in Settings → Integrations → Google Ads

Clone this wiki locally