Hi everyone,
I am Dario Schiraldi, looking to integrate UTM tracking into my HubSpot workflows and APIs to better track campaign performance. Has anyone done this before or have any tips on the best approach to capture and use UTM parameters within HubSpot automation?
I have really appreciate any advice, examples, or best practices you can share! Thanks so much.
It’s totally doable. If you just need to capture UTM parameters when a lead fills out a form, the simplest way is to add hidden fields for each UTM (source, medium, campaign, etc.) to your HubSpot forms. You can then set up a little bit of JavaScript on your landing pages to grab the UTMs from the URL and auto-fill those hidden fields when the page loads. That way, the UTM data gets stamped onto the contact record.
Once the UTMs are in your contact properties, you can use them in workflows, set triggers, branch logic, whatever you need. I usually trigger nurturing emails or assign leads based on UTM values this way.
For API-based stuff, you can capture the UTMs in your site/app, then push them into HubSpot using the Contacts API (set them as properties). That works if you have more custom flows or non-HubSpot forms.
One tip: If you want first-touch and last-touch UTM tracking, consider making separate properties for each. HubSpot will always overwrite the default ones unless you lock them in early.
As ASam26 mentioned above, if you want UTM parameters and other attribution data on contacts you’re creating through the API, you basically need to capture the data yourself and then pass it along when you make the contact.
We actually do this ourselves on the signup form for our SaaS app. We use Attributer to capture the attribution data (UTMs, plus stuff like the channel a lead came from, the landing page, click IDs, etc) when someone first lands on our site. We then save that data against each new signup in our own database, and when we create the contact in HubSpot via the API, we just pass all of it through from our app.
The end result is that the data lands on fields on the contact record, exactly as it would if the person had filled out a native HubSpot form. From there you can use it to build reports, segment workflows, trigger automation, and so on.
Disclosure: I used a voice-to-text AI to help put this response together because I’m not a great writer, but I reviewed and edited it myself before posting.