Skip to Content
How It WorksConversion Tracking

Conversion Tracking

When a visitor submits a form, AttributionHub enriches the submission with conversion metadata alongside the attribution data. This lets you connect each lead back to the marketing touchpoints that drove the conversion.

What Gets Captured

At the moment a form is submitted, the script records:

FieldForm Field NameDescriptionExample Value
Conversion timeah_conv_timestampTimestamp of the form submission2025-07-15T14:32:00.000Z
Conversion URLah_conv_urlFull URL of the page where the form was submittedhttps://example.com/demo
Conversion pathah_conv_pathPath portion of the conversion URL/demo
Event nameah_conv_event_nameForm identifier or event typeform_submit
Target IDah_conv_target_idGenerated identifier for the form elementform-contact-us
Days to convertah_conv_days_to_convertNumber of days between the first visit and the conversion3

These values are stored with the ah_conv_ prefix and included in the form submission alongside attribution fields.

Days to Convert

The days to convert metric measures the time between a visitor’s first recorded visit and their conversion. It is calculated by comparing the first-touch timestamp with the conversion timestamp.

This is useful for understanding your marketing funnel velocity:

  • 0 days — the visitor converted on their first visit (same session or same day)
  • 1-7 days — short consideration period, common for lower-commitment offers
  • 7-30 days — typical for B2B evaluations and higher-value decisions
  • 30+ days — long sales cycles, often involving multiple touchpoints

How Form Population Works

AttributionHub discovers forms on the page and fills matching hidden fields with attribution data. A two-tier handler architecture ensures broad platform coverage:

Specialized Handlers

Dedicated handlers run first for platforms that use iframes, SDK APIs, or cross-origin messaging:

  • HubSpot — injects attribution data via iframe src parameter injection
  • Marketo — supports both iframe parameter injection and the MktoForms2 SDK addHiddenFields API
  • Pardot — populates Pardot form handler fields via iframe src parameter injection
  • ActiveCampaign — sets values in ActiveCampaign embedded forms via iframe src parameter injection
  • Calendly — listens for calendly.event_scheduled postMessage events and creates a synthetic form with attribution data
  • Typeform — sets data-tf-hidden attributes and injects values via iframe hash parameters
  • Zoho — supports both iframe parameter injection and native Zoho form population
  • Jotform — fills Jotform embedded form fields via iframe src parameter injection
  • Webflow — tracks conversions by observing .w-form-done elements via MutationObserver
  • Contact Form 7 — listens for the wpcf7mailsent DOM event to capture conversions

Each specialized handler marks populated forms with data-attrhub-populated to prevent double-processing.

Standard Handler

After specialized handlers have run, the standard handler scans for all remaining forms:

  • Matches <form>, .form, [role="form"], [data-form] elements
  • Applies any custom selectors from settings.formSelectors
  • Skips forms already marked by specialized handlers
  • Sets field values and dispatches change/input events for framework reactivity

Dynamic Form Support

Forms are not always present when the page first loads. AttributionHub handles this with:

  • Retry after ~500 ms — catches forms that render after initial page load
  • MutationObserver — watches the DOM for newly inserted forms (SPA navigation, lazy-loaded modals, multi-step forms)

Field Mapping

All handlers honour settings.fieldMapping, which maps attribution data keys to form field names. No handler hardcodes field names — the mapping is fully configurable.

By default, the script looks for hidden fields with names matching the attribution keys (e.g., a hidden input named ah_ft_channel receives the first-touch channel value). You can override these names in the script configuration to match your CRM or form platform’s field naming conventions.

What Gets Submitted

A typical form submission includes attribution fields from all three touch types plus conversion metadata:

First Touch: ah_ft_channel = "Paid Search" ah_ft_source = "Google" ah_ft_medium = "cpc" ah_ft_campaign = "summer_sale" ah_ft_landing = "/landing/summer" Latest Touch: ah_lt_channel = "Direct" ah_lt_source = "Direct" ah_lt_medium = "direct" Latest Non-Direct: ah_lnd_channel = "Organic Social" ah_lnd_source = "LinkedIn" ah_lnd_medium = "social" Conversion: ah_conv_timestamp = "2025-07-15T14:32:00.000Z" ah_conv_url = "https://example.com/demo" ah_conv_path = "/demo" ah_conv_event_name = "form_submit" ah_conv_target_id = "form-demo-request" ah_conv_days_to_convert = "3"

This gives your sales and marketing teams full visibility into the visitor’s journey from first discovery through conversion.