Correct contact IP integration from Woo for Hubspot tracking


We have a custom plugin connecting our WP Woocommerce to our Hubspot account. What is the best practice for passing each contact, the hubspot utk and their IP address so the Hubspot tracking code will begin picking up on their activities across the site?

This is a screenshot of what we want. Currently NOTHING is being tracked but the Hubspot tracking is in place and working. For instance, our chat window works perfectly.

Thank you!!


Hi @notanothercliche,

How is the plugin creating the contacts in HubSpot? Are you using the contacts API or the forms API? The contacts API is designed for offline contacts, and doesn't support lead tracking in the same way that the forms API does. Can you give me some more details on how your plugin works?


Hi @Derek_Gervais super appreciative of your reply! Our developer used the Contacts API, not the Forms API. What is the minimum I could integrate from the Forms API to get the tracking going? For example, could I get away with creating the contact using the Forms API and 1 or 2 pieces of data followed by using the Contacts API to add the rest of the data OR should I be passing most of the data through the Forms API?

Developer is saying this is additional work, so I need to help guide them to the most efficient way forward.

Thank you so much!!

Attached is my checkout page where contacts are first created. Working backwards, as the developer is syncing these as offline via contacts API. Should we be doing this entirely via Forms API?



Hi @notanothercliche,

Most of the information can be sent to HubSpot via either the contacts API or the forms API; the real issue is that in order to associate web analytics to specific contacts, you have to associate their usertoken with their contact record, and this can only be done using the forms API or some custom Javascript. If the contacts are filling out a form at any stage, like potentially a checkout form, that provides an opportunity to collect this usertoken from their browser.

I would recommend using the forms API to pass the relevant information collected by your checkout form so that you can create the contact and collect their usertoken info. Any other sync that happens outside of a form submission can continue to work with the contacts API.

If you developer has any specific technical questions regarding the use of either API, feel free to have them ask questions here on the forum and I'll be happy to help out.


Hi @Derek_Gervais

Thank you so much. Should I be checking if the contact exists already, or will the Forms API be okay with processing new data collected for an existing contact through the form? Here's my dummy form:

Also, the form is set to default to Lifecycle = opportunity (hidden field). Do I need to pass this data through the Forms API, or is that data handled on the Hubspot processing side and does not need to be passed through the API?


Hi @notanothercliche,

The forms API can handle existing contacts, and will do so in the same way that regular HubSpot forms do: Properties will be updated with new values based on the form submission. All properties that you're updating must be included in the form submission, so you should include the Lifecycle Stage property in your form submission.