top of page

Linking HubSpot form submissions on a Wix website to Adwords clicks

If you have a Wix site and use HubSpot forms, you might have run into issues with accurately tracking your form submissions. We had a case recently with a client who has a Wix site and has two embedded HubSpot forms. The problem was that we were running Adwords campaigns for this client, but when users were filling out the form, every submission was showing up as coming from direct traffic. Even when we did test where we clicked on an ad and filled out a form ourselves, the contact created was never attributed to Adwords, even when we knew it should be.

There were a couple of possible issues here: one was that the ad click takes users to the home page, but the forms are on other pages in the site. We thought that if users are clicking around a bit before filling out the form, they might be losing the tracking parameters before they get to the form. The second issue – and in our opinion more likely the problem — is that Wix requires an HTML iframe element in order to insert custom HTML/javascript like an embedded HubSpot form. Because the content is inside an iframe, it is separated from the rest of the page and the tracking parameters don’t get through to the form.

After a lot of reading and trial and error, we eventually figured out a solution. The way we solved this problem involved Wix Code and a simple workflow in Hubspot to catch the form entries and set the contact’s Original Source property based on a hidden form field value.

1. In HubSpot, I added four hidden fields to the two forms that appear on the website. The fields are utm_source, utm_medium, utm_campaign and utm_term. These fields will be used to capture how the user got to the site

2. At the Site level, I added a script in Wix Code to parse the url and get parameter values if they are present. If the Adwords parameter is present, it stores session items based on the url parameter values that I want to capture.

3. On the two pages where the a form is inserted, I added a page-level script to get the session items I set on the initial landing page and do a postMessage() to the iframe in which the form is embedded.

4. Inside the iframe, another script receives the message, outputs the message data and uses it to fill in hidden fields in the HubSpot form.

5. In HubSpot, we set up a simple workflow to get the form submissions and look for the hidden utm_source field. If that field’s value is ‘adwords’, then the contact’s Original Source property is set as “Paid Search”.

This is how the contact looks after it goes through the workflow. Notice that in the "Contact Created" section, it says "This contact was created from Paid Search". See also on the left the values of the utm_source and utm_medium fields. The utm_campaign and utm_term will display as well.

bottom of page