HubSpot Form Tracking
Track every type of HubSpot form with AnyTrack: the standard embed code, the developer embed code, legacy forms, custom forms that send leads through an API or Zapier, and Typeform. Learn how the Click ID reaches each HubSpot contact.
AnyTrack attributes a HubSpot contact to an ad click when the AnyTrack Click ID reaches the contact. The type of form decides how the Click ID gets there. Find your form in the table, then follow its section. To connect HubSpot first, see the HubSpot integration guide.
| Form type | How the Click ID reaches HubSpot | What you do |
|---|---|---|
| Standard embed code | The Tracking Tag fills in the AnyTrack Click ID field | Add the field to the form one time |
| Developer embed code | The Tracking Tag fills in the AnyTrack Click ID field | Add the field to the form one time |
| Legacy form | AnyTrack adds the field. The Tracking Tag fills it in | Click Sync with HubSpot after you create a form |
| Custom form (API, Zapier, Make) | Your form sends the Click ID with the lead | Add a hidden field and map it to the HubSpot property |
| Typeform | Typeform sends at_click_id to HubSpot | Map at_click_id to the HubSpot property |
How AnyTrack Matches a HubSpot Contact
Section titled “How AnyTrack Matches a HubSpot Contact”When you connect HubSpot, AnyTrack creates the AnyTrack Click ID contact property. The internal name of the property is atclid. AnyTrack reads this property each time HubSpot reports an event for the contact.
AnyTrack matches the contact to a visit in this order:
- The AnyTrack Click ID property. AnyTrack matches the contact to the visitor and to the ad click behind the visit.
- The email address. If the property is empty, AnyTrack tries to match the email address of the contact to a visitor. If the contact has no email address, AnyTrack uses the phone number.
If AnyTrack finds no match, the conversion shows as Unknown. The Click ID gives the most reliable match, so each section below shows how to get it into the property.
Standard Embed Code
Section titled “Standard Embed Code”The standard embed code is the default for a form from the updated form editor of HubSpot. HubSpot loads the form in an iframe.
<script src="https://js.hsforms.net/forms/embed/PORTAL_ID.js" defer></script><div class="hs-form-frame" data-region="na1" data-form-id="FORM_ID" data-portal-id="PORTAL_ID"></div>The Tracking Tag cannot read an iframe. It does not need to: HubSpot publishes form events on the page, and the Tracking Tag listens to them.
- When the form loads, the Tracking Tag fills in the AnyTrack Click ID field, if the form has the field.
- When the visitor submits the form, the Tracking Tag sends a
FormSubmitevent to AnyTrack. The event includes the email address, the name, and the phone number from the form. - When HubSpot creates the contact, AnyTrack reads the AnyTrack Click ID property. By default, AnyTrack tracks the new contact as a
Lead.
The Tracking Tag sends the FormSubmit event with or without the field. The field is what puts the Click ID on the HubSpot contact.
To add the field, open the form in HubSpot and add the AnyTrack Click ID property as a hidden field. The steps are in Add the AnyTrack Click ID to Your Forms.
Test the Standard Embed Code
Section titled “Test the Standard Embed Code”The form below is a live HubSpot form with the standard embed code. This page has the Tracking Tag, and the form has the AnyTrack Click ID field. The line under the form shows the value that the Tracking Tag writes to the field.
Live form
Value of the atclid field Waiting for the form
The field is hidden, so the form does not show it. The value under the form is the Property ID joined to your Client ID (26 characters). If you submit the form, HubSpot saves this value in the AnyTrack Click ID property of the contact. The form belongs to AnyTrack: a submission sends your details to the AnyTrack team.
Developer Embed Code
Section titled “Developer Embed Code”The developer embed code is on the Developer code (Advanced) tab of the embed dialog in HubSpot. HubSpot makes it for custom CSS, and it needs a Marketing Hub or Content Hub Professional or Enterprise subscription. HubSpot writes the form into your page, with no iframe.
<script src="https://js.hsforms.net/forms/embed/developer/PORTAL_ID.js" defer></script><div class="hs-form-html" data-region="na1" data-form-id="FORM_ID" data-portal-id="PORTAL_ID"></div>AnyTrack works the same as with the standard embed code. The form comes from the same form editor and publishes the same form events. The Tracking Tag fills in the AnyTrack Click ID field when the form loads, and sends the FormSubmit event when the visitor submits the form. The same load order applies: the Tracking Tag must start before the form loads.
The setup is also the same: add the AnyTrack Click ID property to the form as a hidden field. If you change the embed code of a form from standard to developer, you do not add the field again. The field belongs to the form, not to the embed code.
Test the Developer Embed Code
Section titled “Test the Developer Embed Code”The form below is the same HubSpot form with the developer embed code. The Tracking Tag writes the same value to the field.
Live form
Value of the atclid field Waiting for the form
Legacy Forms
Section titled “Legacy Forms”A legacy form comes from the legacy form editor of HubSpot. Its embed code calls hbspt.forms.create.
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script><script> hbspt.forms.create({ portalId: "PORTAL_ID", formId: "FORM_ID", region: "na1" });</script>AnyTrack adds the AnyTrack Click ID field to your legacy forms through the HubSpot API. AnyTrack does this when you connect HubSpot, and each time you click Sync with HubSpot in your HubSpot integration.
- When the form loads, the Tracking Tag fills in the AnyTrack Click ID field.
- When the visitor submits the form, the Tracking Tag sends a
FormSubmitevent to AnyTrack.
On a legacy form, the Tracking Tag does both actions only when the form has the field. After you create a legacy form, click Sync with HubSpot.
Custom Forms
Section titled “Custom Forms”A custom form is a form that HubSpot did not make. Examples are an HTML form, a form in a React app, and a form from another form builder. The lead reaches HubSpot through the HubSpot API, Zapier, Make, or another automation tool.
HubSpot creates this contact from a server, with no tracked visit behind it. The Tracking Tag has no HubSpot form to fill in. Your form must carry the Click ID, and your automation must write it to the HubSpot property.
-
Add a hidden field to the form, inside the
<form>element. Set its value to--CLICK-ID--.<input type="hidden" name="click_id" value="--CLICK-ID--"> -
Load the page. The Tracking Tag replaces
--CLICK-ID--with the Click ID of the visitor. -
Send the value of the hidden field with the lead.
-
In the tool that sends the lead to HubSpot, map the value to the AnyTrack Click ID property (
atclid).
Use the table to find the place of step 4 in your tool.
| How the lead reaches HubSpot | Where you map the Click ID |
|---|---|
| HubSpot forms API (form submission) | Add the AnyTrack Click ID field to the HubSpot form that receives the submission. Send a field with the name atclid and the object type 0-1 |
| HubSpot contacts API | Set the atclid property when you create or update the contact |
| Zapier or Make | In the HubSpot action, map the hidden field of your form to AnyTrack Click ID |
For the hidden field rules and the forms that the Tracking Tag cannot fill in, see Form Tracking. For the same pattern with other CRMs, see Pass the Click ID from External Forms to Your CRM.
When the HubSpot Tracking Code Collects Your Form
Section titled “When the HubSpot Tracking Code Collects Your Form”If the HubSpot tracking code is on your website, HubSpot can collect submissions from forms that it did not make. HubSpot calls them non-HubSpot forms. HubSpot then creates the contact itself, and AnyTrack tracks the contact as a Lead.
HubSpot also states three more limits. The tool does not collect a form in an iframe, on a single-page app, or added after the page loads. An app from an AI coding tool such as Lovable is a single-page app. Read Use non-HubSpot forms in the HubSpot knowledge base for the full list.
Prompt for AI Coding Tools
Section titled “Prompt for AI Coding Tools”If you build your website with Lovable, Claude, or another AI coding tool, give the tool this prompt. The prompt adds the hidden field to your form and sends the Click ID to HubSpot. Install the Tracking Tag first: see Single Page App Tracking.
My site uses AnyTrack for conversion tracking. The AnyTrack Tracking Tag isalready in the <head> of index.html. Do not remove or change that script tag.
Update my lead form so that it sends the AnyTrack Click ID to HubSpot:
1. Inside the <form> element, add this hidden input. Keep it uncontrolled (in React, use defaultValue, not value plus state): <input type="hidden" name="click_id" defaultValue="--CLICK-ID--" /> The AnyTrack Tracking Tag replaces --CLICK-ID-- with the real value in the browser.
2. In the submit handler, read the value from the DOM input at submit time, not from React state.
3. Send that value to HubSpot together with the other form fields, as the contact property with the internal name "atclid": - If the form posts to the HubSpot forms API, add this object to the "fields" array: { "objectTypeId": "0-1", "name": "atclid", "value": <the value> } - If a backend function creates the contact through the HubSpot contacts API, add "atclid": <the value> to the "properties" object.
4. If the value is empty or is still the text "--CLICK-ID--", do not send the atclid field.
5. Do not call AnyTrack('trigger', 'FormSubmit'). AnyTrack tracks the form submission automatically.
6. Never put a HubSpot private app token in browser code.After the tool makes the change, do the checks in Verify the Click ID in HubSpot.
Typeform and HubSpot
Section titled “Typeform and HubSpot”With Typeform, two integrations work together:
- The Typeform integration tracks the form. The Tracking Tag adds the Click ID to your Typeform links and embeds as the
at_click_idparameter. Typeform sends each submission to AnyTrack, and AnyTrack tracks it as aLead. - The HubSpot integration tracks what comes after the form: lead status, lifecycle stage, meetings, and deals. For these events, the Click ID must be on the HubSpot contact.
To put the Click ID on the HubSpot contact:
- In Typeform, add
at_click_idas a URL parameter of the form. See the Typeform setup guide. - In Typeform, open the HubSpot integration of the form.
- Map the
at_click_idURL parameter to the AnyTrack Click ID contact property. - Save the mapping.
Typeform calls hidden fields URL parameters. Its HubSpot integration creates or updates the contact by email address, and it can map a URL parameter to a contact property. If Zapier or Make sends your Typeform leads to HubSpot, map at_click_id to AnyTrack Click ID in the HubSpot action.
Test the Typeform Link
Section titled “Test the Typeform Link”The link below opens a live Typeform form of AnyTrack. The Tracking Tag on this page adds your Click ID to the link. Open the link, then read the address of the form: the address contains at_click_id= and your Click ID.
Verify the Click ID in HubSpot
Section titled “Verify the Click ID in HubSpot”- Open the page with your form in a private browser window.
- Submit the form with an email address that is not in HubSpot.
- In HubSpot, open the new contact.
- Find the AnyTrack Click ID property. Verify that the property has a value.
- In AnyTrack, open your HubSpot integration.
- Click the Events Log tab. Verify that the contact shows as a
Leadevent.
If the AnyTrack Click ID property is empty, the form did not send the Click ID. Read the section for your form type again.
The Events Log can show an error that says the contact is not related to your Property ID. The Click ID then comes from a different AnyTrack Property. Verify that the page with the form has the Tracking Tag of the Property that you connected to HubSpot.
To read the status of each event, see Events Log.
HubSpot Form Tracking - Frequently Asked Questions
FAQ was last reviewed on 2026-11-15
Does AnyTrack track a HubSpot form that loads in an iframe?
FormSubmit event when the visitor submits the form. Add the AnyTrack Click ID property to the form as a hidden field one time.What is the difference between the standard and the developer embed code for AnyTrack?
FormSubmit event with each one. The hidden field belongs to the form, so you add it one time.How do I send the Click ID to HubSpot from a custom form?
--CLICK-ID-- inside the form. The Tracking Tag replaces this value with the Click ID of the visitor. Send the value with the lead. Then map it to the AnyTrack Click ID contact property, which has the internal name atclid. You do this in the HubSpot forms API call, in the HubSpot contacts API call, or in the HubSpot action of Zapier or Make. See Form Tracking for the hidden field rules.What happens if the HubSpot tracking code collects my custom form?
Lead. HubSpot states that its non-HubSpot forms tool does not collect hidden fields, so the Click ID does not reach the contact. AnyTrack then tries to match the contact to a visitor by email address. If AnyTrack finds no match, the conversion shows as Unknown. To put the Click ID on the contact, send the lead to HubSpot through the API or an automation tool, and map the hidden field to the AnyTrack Click ID property.How do I pass the Click ID from Typeform to HubSpot?
at_click_id as a URL parameter of your Typeform form. The Tracking Tag adds the Click ID to your Typeform links and embeds with this parameter. Then open the HubSpot integration of the form in Typeform, and map the at_click_id URL parameter to the AnyTrack Click ID contact property. If Zapier or Make sends the leads, map the same value in the HubSpot action. See the Typeform integration guide.