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:
| Field | Form Field Name | Description | Example Value |
|---|---|---|---|
| Conversion time | ah_conv_timestamp | Timestamp of the form submission | 2025-07-15T14:32:00.000Z |
| Conversion URL | ah_conv_url | Full URL of the page where the form was submitted | https://example.com/demo |
| Conversion path | ah_conv_path | Path portion of the conversion URL | /demo |
| Event name | ah_conv_event_name | Form identifier or event type | form_submit |
| Target ID | ah_conv_target_id | Generated identifier for the form element | form-contact-us |
| Days to convert | ah_conv_days_to_convert | Number of days between the first visit and the conversion | 3 |
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
srcparameter injection - Marketo — supports both iframe parameter injection and the
MktoForms2SDKaddHiddenFieldsAPI - Pardot — populates Pardot form handler fields via iframe
srcparameter injection - ActiveCampaign — sets values in ActiveCampaign embedded forms via iframe
srcparameter injection - Calendly — listens for
calendly.event_scheduledpostMessage events and creates a synthetic form with attribution data - Typeform — sets
data-tf-hiddenattributes 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
srcparameter injection - Webflow — tracks conversions by observing
.w-form-doneelements via MutationObserver - Contact Form 7 — listens for the
wpcf7mailsentDOM 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/inputevents 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.