Progressive Profiling info in API response

forms

#1

I'm creating front-end APP that uses HubSpot API to dynamically show HS forms and send form data do HS. I have a problem with Progressive Profiling. I don't know how to distinguish fields that should be visible, from fields that should be hidden because they have been already filled in before.

I've created example form in HS. Most of the fields are marked as progressive except email adress. I have tried to embed this form in two ways - by including JavaScript from HS and by creating my own implementation. In first scenario progressive profiling works fine - at first the form contains all fields. After filling it and sending the form shows only non-progressive fields and the email address is visible but already filled in.

In my own implementation I'm trying to do the same but the data I'm gettin from the API does not inform me if field should be hidden or not. Anyone can tell me which field in API response informs about state of the field?

My example form: https://forms.hubspot.com/embed/v3/form/421670/6de2be4f-a715-4fea-9e48-a29954e0c8c2?callback=hs_reqwest_0&hutk=e9dc5ac06e1e54ce63994de0ba7a7d0e


#2

@Peronczyk In the API response if the field has a value then you know it has already been submitted and you do not need to ask it again. We don't have a field state value but that is because you can determine the state from if the value is known or not from the field.


#3

Thank you @pmanca for your response.

I have another 2 question in this topic:

  1. So what is the exact name of the field that contains value? Is it just "value"? :slight_smile:
  2. What is the best way to get HS form data from API to get Progressive Profilling work? At this moment I'm using backend middleware to collect data from HS and than pass it to my app. This prevents from showing "hutk" to browser/user. But is this a good way? Will this middleware block Progressive Profiling?

#4
  1. Yes it is "value"
  2. Yes you will need to proxy the information as you are doing because we don't allow client-side requests.

#5

Ad 2. So how HubSpot is detecting coming back user if the form data is fetched by backend proxy?


#6

@Peronczyk Through the cookie, You can pass the cookie initially to the backend proxy which would then use that info to fetch the corresponding contact from HubSpot


#7

@pmanca so how to pass information about the cookie to HS API while getting form data? There is no info about that in this page: https://developers.hubspot.com/docs/methods/forms/forms_overview and this https://developers.hubspot.com/docs/methods/forms/v2/get_form

Also You've wrote that there will be 'value' in response but there is no info about that in API DOCS. Why there is only "defaultValue" described?


#8

@Peronczyk This is the endpoint you need.


#9

@pmanca correct me if I'm wrong: to make Progressive Profiling working I need to make 2 separate calls (form and contact) and compare the data to get form filled in with collected data?


#10

@Peronczyk You need to make two calls, One from the client to the proxy server and then one from the proxy server to the HubSpot to get the information. You will use the Contacts API with HubSpot and not the forms API.

Then

After the user submits the data on your form you will use the forms API to enter the info into HubSpot.


#11

Thank you, Your answers helped.

I have (I hope so) last question: how to generate and set 'hubspotutk' entry in Cookies. For example: new user enters my page - he don't have 'hubspotutk' in his cookies. He fills in HubSpot form and send it, so his data is now stored in HubSpot and contact is created. I want to mark him with 'hubspotutk' but I don't know how to receive it.


#12

@Peronczyk So long as the tracking code is on the page the cookie will get created automatically as soon as he enters your page. Then you can associate that cookie to the email address through the form submission.


#13

Thank you for your help @pmanca