Find out how you can automate revenue tracking from HubSpot deals in Google Analytics and Google Ads

What is the purpose of this integration?

This integration allows you to:

How does this integration work?

This integration is available to all our users on the free and paid plans.

Once authenticated, Leadtosale will:

  1. Track when deals hit closed-won status.
  2. Look at all contacts associated with those deals.
  3. Find all the email addresses and phone numbers for those contacts.
  4. Search Leadtosale for leads that match those email addresses and phone numbers.
  5. If it finds a lead, it will process the earliest created lead as a sale, and give it the value associated with the deal.
  6. Send an event to Google Analytics with the deal value.
  7. If any other leads match the contacts on that deal, they will be processed as lost.

Note that there are additional processing steps taken with contact details, like removing any special characters from phone numbers, to ensure the highest possible match rate with Leadtosale leads.

In addition to this, the auto event tracker will send page views and on-site events to HubSpot, depending on how you’ve configured it.

To find out more about the auto-event tracker, read the auto-event tracker documentation.

Setting up the HubSpot integration

To connect your HubSpot hub, use the connect button at the bottom of your container’s ‘trackers’ page.

This will open a dialogue to choose to apply an existing connected HubSpot account, add a new one or only use the page view and event auto event tracking (if you don’t have access to HubSpot yet).

If you select create a new account, you’ll be prompted to login to HubSpot and select the account you want to connect to (if you have more than one). In the below case, I was already logged into HubSpot, so just needed select my account.

Once HubSpot is authorised, it will add that connection to the credentials dropdown menu. When you’re finished, hit save.

Once connected, the behaviour outlined in the above ‘How does this integration work’ section will happen automatically.

Note that HubSpot accounts are associated with businesses, and assigned to containers. Therefore, when you connect a HubSpot account to a container, that account can be re-used across multiple containers in a business.

Tracking HubSpot Forms in iFrames

UPDATE: The form tracker will pick these submissions up by default. No action is required on your end.

Use the custom tracker to track HubSpot forms in iFrames. Use the code below to track these with the custom tracker. Note that your parent page must include jQuery for this to work (requirement from HubSpot).

function eventListenerCallback(){
  window.addEventListener("message", function(event) {
    if( === 'hsFormCallback' && === 'onFormSubmit') {
     var fields =;
    var desired = {};
    for (var i=0; i<fields.length; i++){
    desired[fields[i].name] = fields[i].value;
  if(document.readyState == 'complete'){
else window.addEventListener('load', eventListenerCallback)

For more information about the custom tracker, head to our Custom Trackers help article.

Questions and support

If you have any questions about our HubSpot integration, message us in the chat.