Hubspot API not passing source information on form submission


we use the API for our forms on our website, and we’re finding that there’s no value from the tracking URL being passed about where the traffic is coming from and what’s converting because of this.

For example, we use adwords with utm sources/campaign etc. and the url’s it links to is something like this which should be coming through to the sources report.

But basically the information that gets passed to Hubspot is that it’s source is “offline sources” and Original Source Drill-Down 1 is “FORM” - no indication that they came from a specific ad campaign.

Is there something we can do to make these values pass through properly?

Thank you!


Hi @sam_sau

Those analytics source properties are set based on the analytics data associated with the contact. If you’re using the Forms API to submit form data, this means making sure that the hutk value is being populated with the visitor’s hubspotutk cookie value, since that cookie is what ties the contact record to the data collected by the HubSpot tracking code. Also, it can take several seconds to a minute for the source properties to get set to the correct values based on the analytics data, so if you’re grabbing the contacts immediately after they’re created they may still show the form as the source.

If you are passing the cookie value in the form submission data, and you’re still not seeing the correct source, can you send me a link to an example contact you’re seeing this with?


Thank you so much for your response @dadams - I’ve passed this on to our developer to see that we’re using the hubspotutk cookie, as this sounds like what the issue might be!


hello @dadams we have the same issue, a paid search is showing offline sources or direct traffic. Where can I send you a screen shot?

that is not accurate as I tested with a gmail account I have and clicked a search add …


@javierdomm as mentioned previously in this thread, the source is going to be based on the data associated with the hubspotutk cookie used by our tracking code, so to collect the source, the tracking code would need to be installed (and working correctly) on the page, and the form would also need to pass that cookie value in the hs_context field in the hutk property.

If the code is installed, and you’re also passing the cookie value, can you share an example of the POST data that’s getting sent to HubSpot? There may be a problem with how the hs_context data is formatted.


We did pass the hutk value to Hubspot, Please see our request example.

13:26:40.967 +1100
I, [2016-12-08T02:26:40.967009 #121] INFO – : [] [] [e3131bb3-7b4f-4579-aafa-e4319fc39bd3] [271abab1706b12612b4231cdea786673] Post User data to Hubspot request {“email”=>"", “firstname”=>“Juan”, “lastname”=>“LU”, “customer_goal”=>“Strategic Goals;Productivity”, “lifecyclestage”=>“opportunity”, “hs_context”=>{“hutk”=>“ee5a5c6aaf3f9b525031737cdbe36253”, “ipAddress”=>“”, “pageUrl”=>“”, “pageName”=>“Redii - Recognition and Rewards”}}


Do you happen to have an example of the specific request body used for the POST request? Depending on the specific language or function you’re doing this with, having the hs_context field as a nested array could lead to the value being formatted incorrectly in the actual POST request, so you may need to json encode the data for that field separately.


Hi, We use ruby, and we updated hs_context using JSON encoded data, there is our new request, Please confirm whether it is OK ?

Post User data to Hubspot request {“email”=>"", “firstname”=>“56565”, “lastname”=>“584858”, “customer_goal”=>“Engaged Employees;Employees Retention;Strategic Goals;Productivity”, “lifecyclestage”=>“opportunity”, “hs_context”=>"{“hutk”:“5341ed4a92c8dfdbafffb8fb797b4a1e”,“ipAddress”:“”,“pageUrl”:“",“pageName”:"Redii - Recognition and Rewards”}"}


@javierdomm it’s difficult to say without seeing the exact data being passed in the POST request. Do you have an example contact record that used that new format that I could take a look at?


It is working now, thanks david.


Hi - I’ve noticed that when a visitor comes in from any source (organic social, paid ads, etc), then navigates OFF of the page they landed on (our home page for example) onto another page on our domain (pricing for example), then fills out a form they are being bucketed as direct traffic. This shouldn’t be the case - they should be attributed to the original source that brought them to our site. I believe that Hubspot doesn’t pass the cookie info from page to page. Is there a script available that will let us do this both for traffic from organic sources AND for traffic with UTM parameters? I.e. can we make UTM parameters part of a cookie?