Form accepting property when property not defined in form - hubspot-php

I am using the hubspot-php api to submit data to an old hubspot form in our system. The form has an email property added and that is the only property defined for that form.

The api is submitting a property named

signup_source

to the form and the form is capturing the value and even updating the relevant contact form with the data. I’d like to keep this behaviour, and replicate it elsewhere.

I cloned that form and it is exactly the same in all regards. When I configure the api call to submit to this new form the submission only contains the email and not the sign up source.

I added the

signup_source

property to the new form. Once added the new form captures the value and updates the contact record. I thought maybe the original form once had that property and was then removed and that’s why it still captures the value. However if I remove the

signup_source

property from the new form it still fails to capture the sent value.

Does anyone know why this new form, which was cloned from the original does not capture the additional value?

Hi @Mrk-1 and welcome, it’s so great to see you here! :sun_with_face:
Thanks for reaching out to the HubSpot Community!
I’d love to put you in touch with our Top Experts: Hi @Manobyte, @sylvain_tirreau and @zach_threadint do you have suggestions to share with @Mrk-1, please?
Have a wonderful day and thanks so much in advance for your help! :heart:
Bérangère

Thanks @BérangèreL ,
I’mfollowing up on this. @Manobyte, @sylvain_tirreau, @zach_threadint are any of you able to weigh in on this?

Thanks,

Hi,

I need more details.

Generally speaking, we retrieve information for Hubspot CRM via forms, either via Hubspot forms or via personal forms placed on an external site that Hubspot detects with the tracking code. If we have forms that come from sources other than these two (a website without the tracking code, an application, etc.), we can use the API.
But since forms populate Hubspot properties, it’s easier to use the APIs corresponding to the objects concerned by the data we want to inject. So if the property you want to populate doesn’t exist in Hubspot, it’s impossible to inject it. This only works in one case (unless I’m mistaken): when we have a customized form on a site that contains the tracking code and contains a field that doesn’t have the same name as the name of a property in Hubspot.

So I need to know where you’re sending the data to what? What API are you using?

I’m using the hubspot-php api that I mentioned in my original post and it appears to be submitting data via the v3 legacy submit data to a form endpoint.
The properties all exist in the system (I can go to properties settings and find them in the list), but the forms I’m submitting to do not have the

signup_source

property added (though they’re in the list of properties available to add).

Hi @Mrk-1 ,

Sorry, I’ve been very busy. To understand, I’d need screenshots of the two forms in Hubspot. Can you send them?

I understand and I appreciate you looking into this for me.

I’ve included a screenshot of the form configuration and the submissions.

Thanks for taking a look!

Thank you.

I’ll clarify my request: I need a screenshot like the first one, but with both forms, the old and the new (so that makes two screenshots), and also a screenshot of a form submission (Marketing > Forms > the old and new forms > Submissions > and you click on a submission you made via the API. The right-hand pane containing the submission details, with the captured fields, should appear; this is the pane I’d like), and this for both forms as well (the old and the new). Is this possible?

We agree that neither of these two forms (especially the old one) was placed on an external web page that contained the tracking code, and are you sure of this (the form placed on a page that contains the tracking code is fully captured by Hubspot, even if the field doesn’t exist in Hubspot)?

Why did you give the second screenshot: this is where you are looking to see your signup_source property?

Hi,

My apologies that was the wrong form I included. The second screenshot is the panel that appears when I follow the instructions provided:
“a screenshot of a form submission (Marketing > Forms > the old and new forms > Submissions > and you click on a submission you made via the API. The right-hand pane containing the submission details, with the captured fields, should appear”
I went to the form page, clicked on the Submissions tab then I click on the button that says view. Clicking the submission link takes me to the contact with no submission information.

Can you link me to more info on the tracking code. I’m not familiar with what that is? It’s important to note that I have inherited this system and I was not one of the individuals who created our setup, just FYI, so I’ll need to do some digging to determine if we are using the tracking code.
I’ll also note that when I’m testing the form submission for each of these forms the only thing that is changing is the ID of the destination form.

I’ve included the screenshots for the correct forms below.

Original form with submission details:

Duplicated form with submission details:

Thanks for the info. We can move forward.

I think there’s another piece of code in your file that needs to populate these properties.

You should first check if these properties exist in Hubspot. To do this, go to Settings > Properties > Contacts properties > and search for each of the properties sent in the old form (lead_source, lead_type, gclid, signup_source, etc.). Let me know if they exist here.

Next, I need to know where the data is coming from: I think the data being sent isn’t coming from an online form, but from a payment return via another application. Can you confirm this? You receive a payment confirmation and send it to Hubspot, is that correct?

If not, you need to explain the PHP workflow in which this data submission to Hubspot is inserted (where in which workflow is the submission located?).

If so, I’ll have to wait for your response regarding the properties before answering you.

Next, I need to know if your PHP script is located on a domain name that is registered in Hubspot. Go to Settings > Tools > Content > Domains & URLs > Domains, and check if the domain your PHP script for sending data is running on is in the list. Tell me the answer here.

Finally, I also need you to check whether your tracking code is installed on the site where your scripts are running. To do this, you must have answered yes to the previous question (the domain where your script is running is listed in the domains declared to HubSpot). In this case, go to Settings > Tracking Code or Settings > Tracking & Analytics > Tracking Code, copy the value of the src attribute of the “script” tag, and check if you can find this value in the source code of your pages.

This source code retrieves all your forms that are on your pages (but obviously the form in question here is not a form filled out on a page…) and manages your cookies and the Hubspot banner on your site (for example this allows you to retrieve, in the cookies deposited by Hubspot, an identifier which allows you, in Hubspot, to link all the actions of the same contact together, and this will remove the warning that you have on your collected data: “The cookie needed to link form submissions…”).

Sorry for the delay in responding and the number of questions I’m asking you, but this problem is not trivial. I assume that there is, on your side, another piece of code that adds data to the form submission (you would have to try to capture the complete request that is sent to Hubspot to see the difference between the two submissions). It is also possible that the form ID is used in your code to send other additional information that was kept throughout the purchasing process (if your script fits well into a purchasing process). In this case, this would explain why, when the form id changes, the process is broken.

But these are just assumptions that you need to check.

In my opinion and based on the information I see (if you send a contact’s trace - where they come from, from which campaign, etc. once they have paid), the best thing would be to create these properties in Hubspot and fill them in directly once the payment is validated. Going through the form API is only useful in cases where you have a form that is not accessible by the tracking codes (an app or another site that is not on a domain declared in Hubspot) and you still want to capture submissions. If you just want to keep information, you have to go through the object APIs (here contacts) once you have created these properties in Hubspot, and you can then fill in information throughout your purchasing process. You can then use these properties in workflows, reports, etc.

I have verified that all fields (gclid, lead_source, lead_type, signup_source, lead_campaing, and lead_medium) exist in the system and can be found by searching in the properties settings page.

It’s a lead generation form, no payment is involved. There is a non-hubspot form on our website that sends the data to our php server. The server then submits the data received from the non-hubspot form to the hubspot form via the hubspot-php api. Specifically the Form->submit endpoint. There are some custom non-hubspot related functions we perform with the data which is why it isn’t just an embedded hubspot form. (I’m assuming you’re not referring to the workflows inside of hubspot, but just in case there are no active workflows associated with this form).

The domain the non-hubspot form is on is not listed in the Primary or Secondary domains lists. The domain is however listed in Settings > Tracking Code or Settings > Tracking & Analytics > Advanced Tracking as an external domain and the script in the Tracking Code tab is being loaded via Google Tag Manager.

If it is the tracking code that is picking up the extra data. What would I need to do in order for it to also pick up the new fields, and is there any way I can verify what the tracking code is picking up?

Very good, I understand your context better.

OK. So the domain of the site on which you have your page that contains your external form is correctly referenced in Hubspot as a domain to track.

You should also check on the page that contains your external form that the tracking code is correctly included. Go to Settings > Tracking Code or Settings > Tracking & Analytics > Tracking Code, and copy the value to check if it is in the source code of the page that contains your external form. If you don’t find anything, retrieve your Hubspot account ID (it is in the url when you are on your portal, and when you click on the name of your portal at the top right, it is under the “Account” section) and check if it is in the source code of the page that contains your external form.

If the above searches didn’t yield anything, it’s because the tracking code is not on the page where your external form is located.

If you found one of the results below (be careful if you are looking for your Hubspot portal ID, make sure that you have the isolated number and that this number sequence is not part of a larger number sequence), then we will be able to isolate your problem.

If the data you want to retrieve in your Hubspot form (gclid, lead_source, lead_type, signup_source, lead_campaing, and lead_medium) must be present in the external form on your page (in hidden fields, given the nature of the data), verify that these inputs are indeed in the form.

If this data (gclid, lead_source, lead_type, signup_source, lead_campaing, and lead_medium) is generated after the form is submitted, server-side, you absolutely must try to retrieve the request your script sends to the Hubspot server (the $form variable of the submit function you sent me the link to) and check that the data in question is indeed in the variable sent to Hubspot.

For workflows, I was talking about your workflow (retrieving data on your side, working with the data, and sending data to Hubspot), not Hubspot workflows.

I think that after this message we will be able to find out where your data recovery problem comes from…

Hi @sylvain_tirreau thanks for the direction, and apologies for the delay. I got pulled in another direction this last week and had to switch gears for a while.

I was able to confirm that the tracking script is on the form page, the specified fields are not in the HTML form but are part of the payload going to our server, and I have viewed the logs and confirmed that the data is being sent to Hubspot from our server.
I also noticed that if I send the data with a property name that is not in Hubspot at all, the data appears in the submission, but with a message that it is not updating the contact with that data because it does not exist as a property, however when I add the name as a property in the property settings page, it no longer picks up that data.

Thanks again for your guidance!

Hi @Mrk-1,

No worries about the delay: everyone does what they can when they can. :slightly_smiling_face:

I’m going to ask you to test one last thing.

Create a test property in your Hubspot portal *and* add it to your form, which you target with your request (and, of course, send a value for this property in your form submission via the API).

If it works, I recommend using this method, which is the standard way to submit a form via the API, and not trying to replicate the behavior you had with the old form.

If it doesn’t work, it’s not normal, and you need to make sure your code is doing what it should.

Thanks for replying @sylvain_tirreau,
I’ve followed up with the requested info. Do you have any more information that could be helpful here?

Thanks,
CC: @Manobyte, @zach_threadint