Form API not sending across Google Analytics information




We have a form that is working well with the API, but the hs_context information is not being read by HubSpot. I can see it in the submission email, but it doesn't seem to go to the appropriate fields. The post information is below.

{ firstname: 'Easy',
lastname: 'Test3',
email: '',
phone: '123-456-0000',
leadsource: 'XXXX',
lead_source_notes__c: 'XX',
lead_form: 'Easy',
lead_form_description: 'Subscription',
hs_context: {
hutk: '801e7899635bb6d085dded3585fe87f7',
pageUrl: '' }

Thanks for the help,


Hi @bskidmore,

Are you using the 'Submit form data' endpoint, or the 'Submit form data (AJAX)' endpoint? Both require different formatting. It sounds like you're using the 'Submit data for a form' endpoint, which leads me to believe the issue is related to the formatting of the hs_context object. Can you try including double quotes around both the keys (e.g "hutk") and the values (e.g. "801e7899635bb6d085dded3585fe87f7") of your hs_context object?