Contacts' Original Source not populating after Forms API POST
Hi!
We're sending some of our contacts (those that convert in-app) to Hubspot via the Forms API. About half of our contacts created this way are listed as coming from "Offline Sources." This is incredibly unlikely, as in-app page that triggers the API request has Hubspot tracking code on it itself, so at the minimum we would expect that page to be listed in the users' drill downs.
I have tried testing directly using cURL with no positive results. Testing steps include:
Clear all browsing history, cookies, etc from browser.
Tether internet connection to phone to avoid IP filtering
Browse to a handful of pages containing our company's Hubspot tracking code
Copy the hubspotutk cookie value from dev tools
Replace the cookie value in the sample request body from the docs with my new cookie value
Submit the following cURL command:
curl -d "firstname=TestContact&lastname=FormSub&email=formsub@hubspot.com&newcustomproperty=testing&hs_context%3D%7B%22hutk%22%3A%22HUBSPOTUTK_COOKIE%22%2C%22ipAddress%22%3A%22192.168.1.12%22%2C%22pageUrl%22%3A%22http%3A%2F%2Fdemo.hubapi.com%2Fcontact%2F%22%2C%22pageName%22%3A%22Contact%2BUs%22%2C%22redirectUrl%22%3A%22http%3A%2F%2Fdemo.hubapi.com%2Fthank-you%2F%22%7D" -H "Content-Type: application/x-www-form-urlencoded" -X POST https://forms.hubspot.com/uploads/form/v2/{HUBSPOT_ID}/{FORM_ID}
Check the contact property, and see this:
The fact that the request works about half the time on production is odd. As is the fact that when it doesn't work on production, it is shown as "Offline Sources," but manually with cURL I'm seeing "No URL."
Contacts' Original Source not populating after Forms API POST
Hi @sam_topstep, I can't think of a reason off the top of my head that would indicate why in production this code would only work half of the time unless the contact was specifically meant to not be tracked. Navigating around my own site and submitting the same request you made to my own portal with my own hutk yielded a positive result on which page my contact submitted the form on and a successful association with a hubspot tracking cookie.
Make sure that your request is formatted properly with the body properly urlencoded as a malformed hs_context parameter is normally where I see most issues with the Forms API.