ActiveCampaign
ActiveCampaign is a popular email marketing and marketing automation platform used for email campaigns, automations, CRM, and lead scoring. It offers two ways to embed forms on your website, and AttributionHub handles both:
- Standard inline embed — ActiveCampaign forms rendered as standard HTML
<form>+<input>elements on the page. These are handled by the standard forms handler automatically, just like any other HTML form. - Iframe widget mode — ActiveCampaign’s floating widget or modal forms rendered inside cross-origin iframes hosted on
activehosted.com. The dedicated handler injects attribution data as URL parameters on the iframe source.
Both modes are detected and populated automatically. No extra configuration is needed beyond adding hidden fields in ActiveCampaign.
Prerequisites
Before you begin, make sure:
- The AttributionHub tracking script is installed on your site (see Installation)
- You have an ActiveCampaign account with access to create or edit forms
- You have access to your website’s code or CMS to add the embed code
Step 1: Create Custom Fields in ActiveCampaign
ActiveCampaign uses custom fields on contacts to store additional data. You need to create these fields so attribution values have somewhere to land.
- In ActiveCampaign, go to Settings (gear icon) > Data Management (or Custom Fields under Lists & Forms in older versions)
- Click Add Field
- For each attribution field you want to track:
- Set the Field Label to something descriptive (e.g., “Attribution Channel - Latest”)
- Set the Field Type to Text Input (single line text)
- Under Personalization Tag (or API name), note the tag name — you will use this as the field name. If ActiveCampaign generates a tag like
%ATTRIBUTION_CHANNEL_LATEST%, the underlying field name is typically the lowercase, underscored version
- Click Add and repeat for each field
When adding these fields to your form (Step 2), you will map them to the AttributionHub field names.
Step 2: Add Hidden Fields to Your Form
For Standard Inline Embeds
- In ActiveCampaign, go to Website > Forms (or Forms under Lists & Forms in older versions)
- Open the form you want to edit, or create a new form
- In the form builder, add your custom fields to the form
- For each attribution field, click on the field and check the Hidden option (or set it to hidden through the field settings)
- In the field settings, set the Field Name (the HTML
nameattribute) to match the AttributionHub field name (e.g.,ah_lt_channel) - Save and publish the form
For Iframe Widget Mode
If you use the floating widget embed, the form is inside an iframe. You still need to create the custom fields in ActiveCampaign, but instead of setting them up as hidden form fields, make sure the field names match the ActiveCampaign URL parameter names so they can be pre-filled.
Step 3: Embed the Form on Your Page
Standard inline embed:
<!-- ActiveCampaign standard embed code -->
<div class="_form_XX"></div>
<script
src="https://youraccountname.activehosted.com/f/embed.php?id=XX"
type="text/javascript"
charset="utf-8"
></script>The standard forms handler detects inline ActiveCampaign forms automatically. No special configuration needed.
Iframe widget embed:
<script
src="https://youraccountname.activehosted.com/f/embed.php?id=XX&type=floating"
type="text/javascript"
charset="utf-8"
></script>The dedicated handler detects ActiveCampaign iframes by looking for:
iframe[src*="activehosted.com"]iframe[src*="activecampaign.com"]
Step 4: Test the Integration
- Visit a page on your site that contains the ActiveCampaign form
- Open your browser’s DevTools (F12)
- For inline embeds: inspect the hidden
<input>elements inside the form and check that they have attribution values - For iframe widgets: find the iframe in the Elements panel and check that its
srcURL includes attribution parameters - Submit a test form entry
- In ActiveCampaign, go to Contacts and find the test submission. The custom fields should contain attribution values
For a full testing walkthrough, see Verify It Works.
How It Works
Standard Inline Embeds
ActiveCampaign’s standard embed renders a regular HTML form on the page. AttributionHub’s standard forms handler discovers forms matching form, .form, [role="form"], and [data-form] selectors, finds hidden fields whose name attributes match your field mapping, and sets their values.
Iframe Widget Mode
For the floating widget / modal form rendered inside a cross-origin iframe:
- AttributionHub detects iframes with
activehosted.comoractivecampaign.comin theirsrc - It reads attribution data from localStorage
- It appends field values as URL search parameters on the iframe
src - The iframe reloads with the parameters, and ActiveCampaign pre-fills the corresponding fields
Recommended Hidden Fields
The table below lists the most commonly used fields. For the complete field catalog, see Field Reference.
Core Attribution Fields (Latest Touch)
| Field Name | Description | Example Values |
|---|---|---|
ah_lt_channel | Channel group (latest touch) | Paid Search, Organic Social, Direct |
ah_lt_source | Traffic source name | Google, Facebook, Direct |
ah_lt_medium | Traffic medium | paid, organic, social, email |
ah_lt_campaign | Campaign name | spring_sale, Organic Search |
ah_lt_content | Content classification | Paid Search Ad, Social Post |
ah_lt_term | Search keyword (if available) | running shoes |
ah_lt_landing_url | Landing page URL (no query string) | https://yoursite.com/pricing |
Core Attribution Fields (First Touch)
| Field Name | Description | Example Values |
|---|---|---|
ah_ft_channel | Channel group (first touch) | Paid Search, Organic Social |
ah_ft_source | Traffic source name | Google, Facebook |
ah_ft_medium | Traffic medium | paid, organic, social |
ah_ft_campaign | Campaign name | launch_campaign |
ah_ft_landing_url | Original landing page URL | https://yoursite.com/blog/post |
Global Fields
| Field Name | Description | Example Values |
|---|---|---|
ah_visitor_id | Unique visitor ID, persistent across visits | a1b2c3d4-e5f6-7890-abcd-ef1234567890 |
ah_touch_count | Total number of recorded visits | 5 |
For additional fields including latest-non-direct touch (
ah_lnd_*), drill-down fields, raw UTM parameters, and ad click IDs, see the full Field Reference.
Custom Field Mapping
If your ActiveCampaign custom fields use different names, override the defaults:
<script>
window.attrhub = {
settings: {
fieldMapping: {
"latest.attribution.channelGroup": "ac_channel",
"latest.attribution.source": "ac_source",
"latest.attribution.campaign": "ac_campaign",
},
},
};
</script>See Configuration for the full mapping reference.
Tips
- Automations — Use attribution data in ActiveCampaign automation triggers. For example, start a different automation sequence for contacts who arrived via “Paid Search” versus “Organic Social”.
- Lead scoring — Add attribution-based scoring rules. Give contacts from high-intent channels (like branded search) a higher lead score.
- Segmentation — Create contact segments based on attribution values. Send targeted follow-up emails to contacts grouped by their original traffic source.
- CRM deals — If you use ActiveCampaign’s CRM features, map attribution fields to deal custom fields to track which marketing channels generate the most pipeline revenue.
- Site tracking combination — ActiveCampaign has its own site tracking. AttributionHub complements this by providing detailed channel and source attribution that ActiveCampaign’s built-in tracking does not offer.
Troubleshooting
Fields are empty after form submission
- For inline embeds, verify the hidden field
nameattributes exactly match the AttributionHub field names (or your custom field mapping). Names are case-sensitive. - For iframe widgets, inspect the iframe
srcin DevTools to confirm attribution parameters are present. - Make sure the custom fields exist in ActiveCampaign and are added to the form.
- Enable logging (
enableLogging: truein settings) and check the browser Console.
Inline form not detected
If your ActiveCampaign inline form uses a non-standard container, add a custom form selector:
window.attrhub = {
settings: {
formSelectors: ["._form_XX form"],
},
};Replace _form_XX with the actual class of your ActiveCampaign form container.
Widget form not appearing
The floating widget form only appears when triggered (e.g., after a delay or on a button click). AttributionHub’s MutationObserver watches for dynamically inserted iframes, so the widget should be detected when it appears. If attribution data is still missing, check that the iframe loads from an activehosted.com or activecampaign.com domain.