Connecting HubSpot and Google Analytics for Full Visibility

Oeuyown Kim, Analytics Strategist

Updated on September 5, 2019, to include new examples and insights.

A challenge we’ve seen all too often in the world of analytics is the minimal visibility clients have into their true return on investment—not just an ROI on how many leads were captured, but how many qualified leads were captured and how many of those turned into actual sales. ROI for actual sales is necessary when reporting on return by channel, determining paid budgets, and discerning the amount that can and should be invested in acquiring and keeping your customers.

These insights are actually available, and are a result of what we call “Closed-Loop Analytics,” which links your website data (campaign clicks, acquisition sources, on-site conversions, etc.) with your CRM data (lead status, closed sales, etc.). In this blog post, we’ll walk through how to set up Closed-Loop Analytics by integrating Google Analytics and HubSpot data.

Note: The general process of capturing this type of data can be applied to other platforms. However, for this post, we’ll be going through the specifics of integrating HubSpot with Google Analytics.

When to Set Up Closed-Loop Analytics

Although Closed-Loop Analytics can be of use to any site, it’s particularly helpful for businesses with long sales cycles, when sales occur offline, and ones where most of the leads captured online don’t typically result in sales. If you’re using a CRM like HubSpot, you have the ability to track the status of different leads and mark them for follow up. Connecting that lead data in HubSpot with Google Analytics allows you to accurately credit channels and campaigns for website leads that have the potential to become sales and even those that actually become final sales.

Closed-Loop Analytics also results in more accurate lifetime value metrics in analytics platforms, such as Google Analytics. This type of information empowers you to make data-backed decisions into how much a customer is worth investing in acquiring and retaining. For example, you could use Google Analytics to see which whitepapers were downloaded by your MQLs from HubSpot and justify investing more resources in creating more of that type of content.

There’s an abundance of data that can be gathered, aside from what’s already been mentioned. Using Closed Loop Analytics, you can segment user data by lead status or field form, discern trends among the most qualified marketing leads, and identify the source that drives the most leads long-term. And you can then use all of this data to create Google Ads audiences and optimize towards them; using this information to fine-tune your marketing efforts.

How to Integrate HubSpot with Google Analytics

Broken down, Closed-Loop Analytics is the process of tracking individuals through Unique Identifiers (UIDs) in your analytics platform, sending the UID through your form to your CRM, and then marrying the data either back in your analytics platform or a reporting platform, like Google Data Studio.

You can gain all of these insights through five steps:

  1. Prepare your analytics platform to capture the UID
  2. Capture UID using a tag management system
  3. Customize forms to send the UID into your CRM
  4. Export CRM data for use in the analytics platform
  5. Begin building reports and analyzing data

Prepare Google Analytics to Capture Hubspot Data

In Google Analytics, we’ll configure your property to capture your UID and additional dimensions from HubSpot, then create your data set to capture these dimensions.

To create your custom dimensions, navigate to Admin > Property > Custom Definitions > Custom Dimensions, then hit +Custom Dimension. This is where we’ll create a custom dimension that’ll capture our UIDs and associate them with each individual user we track in Google Analytics.

Screenshot showing the steps to create custom dimensions in Google Analytics

Name your custom dimension, set your scope as ‘user’ (so the UID will persist among sessions and not just within a session), and take note of the index number that’s provided.

This is when you can add in additional custom dimensions that you’ll send back into GA from your CRM. For example, you may want to capture and associate Lead Status, Interest Indication, or Company. Following the same process for the UID custom dimension, create new custom dimensions for every piece of information you’d like associated with your users in GA.

Next, we’ll create your data set with the dimensions to import from your CRM. Navigate to Admin > Property > Data Import in Google Analytics and click ‘Create.’

Screenshot showing the steps to create a data set with dimensions from your CRM in Google Analytics

Configure your data set to the specifications shown above:

  1. Type: User Data
  2. Name the data set and select the GA view for importing
  3. Set the Join Key as your User ID custom dimension
  4. Select the custom dimensions that were created to capture your CRM data
  5. Select ‘Yes’ to overwrite the data upon imports (this ensures that dimensions will update over time for the same user—for example, when a Lead Status changes from New Lead to MQL)

Once you save your data set, it will create an Excel sheet for you that’s formatted the way Google Analytics will be able to understand and import the data.

Setting Up User ID Tracking with Google Tag Manager

User ID Tracking is necessary to facilitate Closed Loop Analytics properly. This process results in unique, non-PII (no Personally Identifiable Information) UIDs for every user on the site. These UIDs are recorded every time the same user visits the site, stitched together for a full user view, and integrated with our CRM data.

Recently, Michael Wiegand, our Director of Analytics, published a blog post describing in detail how to set up User ID tracking for full visibility into online-to-offline attribution. Visit his post for in-depth steps on how to set up User ID cookies and capture them in Google Analytics.

Customize Your HubSpot Forms to Capture UIDs

Your HubSpot forms need to be updated to collect and tie together UIDs once they’re set up. The objective of this step is to grab the UID value and push it into a hidden field that’s submitted along with other lead information into our CRM.

    1. Navigate to Setting > Properties > Create Property
    2. Create a Custom Property, defining these criteria
    3. Set the Label and Internal Name as ‘ruid’
    4. Navigate to Marketing > Lead Capture > Forms
    5. Create a new ‘Single-line text’ field
    6. Set the ‘Field Label’ as ‘ruid’ and configure the rest of the fields as shown below:

Screenshot showing how to customize your HubSpot forms to capture UIDs

  1. Save the field
  2. Edit the field by clicking on it and check the box that says ‘Make this field hidden’

Integrate Your HubSpot and Google Analytics Data

Once the User IDs are collecting in Google Analytics, passing through to your CRM, and your analytics property is set up to capture this data, we can begin integrating the data.

There are two options to marry this data:

  1. Export the data from HubSpot and import it into Google Analytics, or
  2. Create a Google Data Studio Report

Import HubSpot Data into Google Analytics Reports

To import CRM data into Google Analytics, we have to export the data we want from HubSpot and format it into the Excel sheet that was provided from our data set. This is set up through the following steps:

  1. Download your HubSpot data by either:
    • Downloading an add-on in a Google Sheet and entering your HubSpot API key or,
    • Custom exporting the data from HubSpot
  2. Set up your data pull to pull all lead fields
  3. Scrape the desired data out of the raw data
  4. Format the output to match the data set sheet from Google Analytics
  5. Download the sheet as a .csv

Once you have the data formatted properly, we can import it back into Google Analytics:

  1. Navigate back to Data Import in Google Analytics (Admin > Property > Data Import)
  2. Click on ‘Manage Uploads’
  3. Click ‘Upload File’

This will take a minimum of 24 hours to upload and parse data properly. You’ll want to create a cadence for this process to update lead dimensions, such as lead status, and to add new leads to your Google Analytics data.

Create a Google Data Studio Report

The aforementioned blog post, Online-to-Offline Attribution Made Simple—as simple as it can get, really—also dives into how to connect our HubSpot Google Sheet with a Google Analytics data source into a Google Data Studio report.

What to Do with Integrated CRM and Website Data

After you’ve completed these steps, your HubSpot data will be connected to your Google Analytics data either through Google Analytics or Google Data Studio! You can begin analyzing this data for ROI, lifetime value, or build audiences in Google Ads to begin optimizing for more targeted audiences.

View User Data in Your Reports

First, try pulling in User IDs as a Secondary Dimension alongside other dimensions in your reports to begin identifying trends.

Screenshot showing User IDs as a secondary dimension in Google Analytics

Play around with different combinations and reports, looking at your important metrics, such as submitting forms on the site.

Next, replace your User IDs with custom dimensions you created from your CRM. Dimensions such as Lead Status, for example, can be analyzed to identify the “unicorns” on your site.

Screenshot showing a custom dimension of Lead Status to replace User IDs

Locate these users and figure out how to optimize your site and marketing efforts to attract more of them.

Inform Other Marketing Efforts with Your Data

The most obvious use of this data is viewing the performance of your site’s content. For example, view Lead Status paired with Landing Pages and Most Visited Pages on your site to identify which pieces of content are bringing in new, high-quality traffic and eventually converting your users.

Once you’ve identified your “unicorns,” scrutinize them and see what they all have in common in their user behavior. Viewing your content alongside these users’ behavior will allow you to identify commonalities among what should be your “evergreen” content (content that is always relevant). Use these analyses to push this content forward and make a case to invest in more content that is similar.

Keep in mind that there’s plenty you can do with the wealth of data you now have and it’s not strictly limited to on-site optimizations. You can use this data to optimize your paid efforts, for example.

Create Google AdWords audiences in Google Analytics with options you’ve never had access to before. Build your audiences and create retargeting lists based on Closed Leads or Marketing Qualified Leads. You can now begin optimizing your paid campaigns for only the groups of users and campaigns that result in high-quality leads and cut out wasteful spending on users that become disqualified leads.

For businesses with a long sales cycle, high conversions, and low actual sales, the additional CRM dimensions offer unmatched visibility for the long-term. View your CRM dimensions alongside your Google AdWords campaigns in Google Analytics to identify the campaigns that are actually bringing in high (and low) quality leads over time.

Final Thoughts

Regardless of what you end up doing with the data, it’ll provide you a new level of visibility you’ve been restrained from before. Even if you’re still debating how this wealth of information could be useful specifically for you, get started on collecting the data; the more you collect, the better. I assure you, it will eventually answer important questions for you in the future.

Start call to action

See how Portent can help you own your piece of the web.

End call to action
0

Comments

  1. Is it possible to implement not only for the leads captured through forms but for all contacts / leads (including those manually added in Hubspot). Thank you!

    1. Hi Anna,

      Thanks for reading! There would have to be another unique dimension or action that happens on the website that could be used to identify that user in HubSpot. For example, an authenticated login could identify the user by username or email address in your CRM and associate that website user with the same User ID. Otherwise, it’s not possible to identify users in your CRM based on the anonymous website engagement data that’s collected in GA due to privacy concerns.

      Thanks!

        1. Hi Milan,

          You can certainly use the GA Client ID as well but setting User IDs on sites with authenticated logins allows you to track users across browsers and devices. Client ID is limited to a specific browser and/or device so you could end up with multiple Client IDs for one user.

  2. I tried to add custom property as a hidden field to collect UID but I can’t find the that button. Could you more specify on this step

    Thank you in advance

  3. Hello,

    I’m trying to recreate this process here and I wonder, you will only be able to see, using this set-up effective deals you have right? Or will I also be able to check contacts data before they enter in a deal loop inside hubspot.

    I can now see that User ID data is being generated, however I assume data will only refer to future deals generated right? Or is there a way to match past data as well?

    Kindly,

    1. Hi Luis,

      You’ll only be able to connect the data within HubSpot with your GA data by user after they’ve submitted a form—and also, only after a User ID field has been set up in your forms within HubSpot.

      There’s no way to match the past data since there won’t be a pre-existing ID that can be used as a key.

      I hope that helps answer your question!

  4. Also, will Key UserID and Import Data User ID be the same, basically in a excel file it will be 2 column with exact same User Ids but with different header names.

    Is this accurate?

    1. Yes, exactly! You’ll use that User ID as the join key between the two files. The User IDs should match up despite the different header names.

  5. But at what point User ID gets generated? Is it generated by Analytics, HubSpot or the website itself?

  6. I added the ruid/User ID hidden field in all of our forms but it seems like the data is not getting captured. Meanwhile, other hidden fields like utm_source, utm_medium, etc are being captured. Why do you think this is not working? I also have a gclid hidden field in the same forms. Is that why?

    1. Hi Terence,

      It’s hard to know why this isn’t working for you without seeing the page itself or knowing what’s in your GTM container.

      Mind sending me some more information to [email protected] and I’ll take a look for you?

      Thanks for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *

Close search overlay