Pass URL parameters (non hubspot form) and attribute them to a contact



I'm using a non-hubspot form, and I want to pass URL parameters and assign those to a new/existing contact.


I understand that to pass URL parameters, I need to create a property that has the internal name of the parameter whose value I want to pass on. I did that, but when testing (I've added ?source=google&campaign=test123 etc. to the end of URL)- the contact doesn't get updated with those new properties values (e.g. source and campaign).


Any suggestions on how to fix this?


3 Replies 3
Key Advisor

If you are doing this with a non-hubspot form, what you need to do is have a script grab those GET variables (the variables from a URL string) and save them to a hidden field value on your form so when the form submits those hidden values are captured at the time of submission.  Simply adding those values to the end of the URL without a way to process the hand off to your form won't pass anything to Hubspot.


Hi Ben,
I'm also using a non hubspot form and sending the data on submit through this API:
I've retrieved the utm params from the url, and I'm sending them in "fields".

 fields: [
          { name: 'firstname', value: values.first_name },
          { name: 'lastname', value: values.last_name },
          { name: 'email', value: },
          { name: 'company', value: },
          { name: 'website', value: values.url },
          { name: 'country', value: country },
          { name: 'utm_campaign', value: utmParams.utm_campaign },
          { name: 'utm_content', value: utmParams.utm_content },
          { name: 'utm_medium', value: utmParams.utm_medium },
          { name: 'utm_source', value: utmParams.utm_source },
          { name: 'utm_term', value: utmParams.utm_term },

When submitting - I get an error that all five of the "utm fields" are not in form definition.
I've added them to the form definition, but the error persists. 
When I submitted without those fields - the submition succeeded and the data was sent to HS. 
If I can't submit those values manualy using this API, what's the correct way?


Key Advisor

@InaSingat - Your issue is completely different than the original post. In your example, you are not using the non-hubspot forms feature, but rather you are using your own form and a custom form processor that is opening an API connection to post the data to the server.  If the fields exist from your end, but the script is generating an error, your developer should use this API call to get all contact fields and make sure they are matching up fields properly ( ).  If they are and are still receiving an error, then I would have your dev team get in touch with the Hubspot team as if there is an error in the API on a more technical level they would be the only ones who could help out.