HubSpot Forms + Meta Ads Conversion Tracking Setup

I see this specific combination broken in about 35% of the accounts I audit. The biggest issue? Most people think HubSpot’s native Meta pixel integration handles everything, but it doesn’t fire custom conversion events for your specific campaigns. You end up with HubSpot recording the lead but Meta showing zero conversions, making your ROAS look terrible when it’s actually profitable.

What You’ll Have Working By The End

Prerequisites

Step 1: Set Up Meta Pixel Event in GTM

First, create the client-side tracking that’ll fire when someone submits your HubSpot form.

In GTM, create a new trigger:

Create a new tag:

Create these GTM variables:

  1. Event ID (Data Layer Variable): event_id
  2. Form Title (Data Layer Variable): form_title

Step 2: Add HubSpot Form Event Listener

Add this code to your website (either in GTM as a Custom HTML tag that fires on All Pages, or directly in your site’s footer):

// HubSpot form submission listener
window.addEventListener("message", function(event) {
  if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted') {
    
    // Generate unique event ID for deduplication
    var eventId = 'hs_' + event.data.id + '_' + Date.now();
    
    // Push to data layer for GTM
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      'event': 'hubspot_form_submit',
      'event_id': eventId,
      'form_id': event.data.id,
      'form_title': event.data.formDefinition.formName || 'HubSpot Form',
      'page_url': window.location.href
    });
    
    console.log('HubSpot form submitted:', event.data);
  }
});

// Backup method for older HubSpot embeds
if (window.hsConversationsAPI) {
  window.hsConversationsAPI.onReady(() => {
    window.addEventListener('hsFormCallback', function(evt) {
      if (evt.detail.type === 'onFormSubmitted') {
        var eventId = 'hs_' + evt.detail.object.formId + '_' + Date.now();
        
        window.dataLayer.push({
          'event': 'hubspot_form_submit',
          'event_id': eventId,
          'form_id': evt.detail.object.formId,
          'form_title': evt.detail.object.formName || 'HubSpot Form',
          'page_url': window.location.href
        });
      }
    });
  });
}

Step 3: Configure Meta Conversions API (CAPI)

For the 15-25% of users blocking client-side pixels, you need server-side tracking. Set this up in your HubSpot workflow or via webhook.

In HubSpot, create a new workflow:

Here’s the CAPI payload structure you’ll send:

{
  "data": [
    {
      "event_name": "Lead",
      "event_time": Math.floor(Date.now() / 1000),
      "event_id": "hs_" + contact.formSubmission.formId + "_" + Date.now(),
      "event_source_url": contact.formSubmission.pageUrl,
      "action_source": "website",
      "user_data": {
        "em": [sha256(contact.email)],
        "ph": [sha256(contact.phone)],
        "fn": [sha256(contact.firstname)],
        "ln": [sha256(contact.lastname)]
      },
      "custom_data": {
        "content_name": contact.formSubmission.formName,
        "content_category": "lead_generation",
        "currency": "USD",
        "value": 10.00
      }
    }
  ],
  "access_token": "YOUR_SYSTEM_USER_ACCESS_TOKEN"
}

Important: The event_id must match between your pixel event and CAPI event for proper deduplication. Use the same format: hs_[form_id]_[timestamp].

Step 4: Set Up Custom Conversion in Meta

In Meta Business Manager:

  1. Go to Events ManagerCustom Conversions
  2. Click Create Custom Conversion
  3. Data Source: Your Meta pixel
  4. Conversion Event: Choose “Lead” from the dropdown
  5. Rules: Add rule “content_category equals lead_generation”
  6. Conversion Name: “HubSpot Lead Submissions”
  7. Category: Lead
  8. Conversion Value: Set to your average lead value (optional but recommended)

Step 5: Testing & Verification

Test the Client-Side Pixel

  1. Open your website in an incognito browser
  2. Open Meta Events ManagerTest Events
  3. Submit a test form
  4. Within 30 seconds, you should see:
    • Event name: “Lead”
    • Parameters: content_name, content_category, event_id
    • Browser ID matches your test session

Test Meta CAPI

In Events Manager → Data Sources → Your Pixel → Diagnostics:

Cross-Reference Numbers

Check these daily for the first week:

Acceptable variance is 5-15%. If Meta shows 20%+ fewer conversions, your CAPI isn’t working properly.

Troubleshooting

Problem: Meta Events Manager shows PageView events but no Lead events. → Your HubSpot form listener isn’t firing. Check browser console for JavaScript errors. Make sure you’re testing on a page with an actual HubSpot form, not just the tracking code.

Problem: GTM Preview mode shows the trigger firing but Meta doesn’t receive events. → Your Meta pixel tag configuration is wrong. Double-check the pixel ID matches exactly. Also verify the Event parameter is set to “Lead” not “lead” (case sensitive).

Problem: Meta shows Lead events but they’re not being attributed to your ads. → The events are firing too long after the ad click. HubSpot forms with heavy validation can delay submission. Check the event_time in Events Manager - if it’s >7 days after click, attribution is lost.

Problem: CAPI events appear in diagnostics but don’t count toward conversions. → Event deduplication is failing. The event_id format between pixel and CAPI must be identical. Check that your timestamp generation method is consistent.

Problem: Conversion count is 2x what it should be. → You’re double-counting pixel and CAPI events. Either your event_id deduplication isn’t working, or you have multiple tracking methods firing. Check Events Manager for duplicate events without matching event_ids.

Problem: Meta reports way fewer conversions than HubSpot form submissions. → Most likely iOS blocking. If the gap is 20-40%, that’s normal for iOS14+. If it’s >50%, check that your CAPI is actually working and verify the user_data hashing is correct (lowercase, trimmed, SHA256).

What To Do Next

Once your HubSpot Forms → Meta tracking is solid, consider these related setups:

This guide is part of the Meta Ads Conversion Tracking Hub — complete setup guides for tracking any lead source in Meta Ads.