Forms API how to pass HTTP referrer value?


We have some form transactions with a client and the “source” will only record as “Direct” even when the lead links to the form from a 3rd party site (tested/verified).

I’m assuming we’d somehow use the hs_context JSON packet and pass the value from HTTP_Referer (?). I know how to do this with ipAddress, for example, so I’m assuming this is similar.

Thanks for any suggestions,



Hi @Chuck_Wyatt

The Original Source Type property (hs_analytics_source) can’t be set manually, as it is set automatically based on the analytics data we have for that record. That analytics data gets associated with the contact through the hubspotutk cookie, passed in a form submissions in the hutk parameter inside the hs_context field, so you’d need to make sure that you’re including that hutk parameter, along with having the tracking code installed on your site.


Working with our partner who has developed the ruby app that utilizes the form API, a clarification question that I’m passing along, thanks so much –

We already pass through ‘hubspotutk’ cookie via ‘hutk’ parameter in hs_context. That part is working fine because we can see all the activity for that user after the user has been registered via an API form.

The problem appears to be with the initial page only. There is ‘hsfirstvisit’ cookie on the page that references the origin page. That information is not being set for the user. Who is supposed to set it? Is it set via some Javascript library call or an additional parameter in hs_context?

Chuck Wyatt


The hsfirstvisit cookie is set by our tracking code, but it’s not currently used for the analytics properties that get populated for the contact record. Those properties should still get set automatically if you’re passing the hubspotutk cookie with the form submission, since the first page is set based on the first page we record for the visitor. It can take a few minutes for the analytics properties to get populated, so you may not see them immediately when the contact is created, but if you’re seeing other analytics properties being populated but not the first page property, can you send me a link to a contact you’re seeing that with?