Google Analytics and Hubspot: recording conversions with GA4

07.11.2022
by Meike Müller
SEA
Banner

Here you will find instructions on how to record conversions from HubSpot forms in Google Analytics GA4 using GoogleTagManager (also with ServerSideTracking if necessary). We are encountering a common problem here:

HubSpot forms are loaded in an iFrame and the GoogleTagManager cannot automatically capture form submissions at this level. In the following tutorial, we will show you how we can work around this and still capture all form submissions in five steps.

Reading time 5 min

1. create data layer variables

This step takes place in the GoogleTagManager (not the ServerSideManager, if you are using ServerSideTracking).

First, we need to be able to access three data layer variables. To do this, we create them under the variables:

Google Tag Manager Integrierte Variablen

This step is not mandatory, but in our case we still want to pass the parameters eventCategory, eventAction and eventLabel to our GA4 property as in UA-Analytics.

2. create trigger

Now we define a trigger that reacts to the event name hubspot_form_submission and otherwise triggers all results with this name.

Google Tag Manager Trigger erstellen

3. create tag and assign trigger

As a final configuration step, we create a tag of the tag type "GoogleAnalytics: GA4 event". This tag then forwards the event to the GA4 or ServerSideTracking container, depending on the configuration:

Google Tag Manager Tag-Konfiguration

4. triggering an event after submitting a HubSpot form

As part of its JavaScript Embedd API, HubSpot provides a function called onFormSubmit, which is triggered after the form is submitted. We use this to set a few DataLayerVariables, which we then intercept in the TagManager and forward to GA4.

The DataLayerVariables 'eventCategory': 'forms', 'eventAction': 'submit' and 'eventLabel': window.location.pathname are not absolutely necessary, but facilitate further filtering of the submissions within GA4.

5. mark events in GA4 as conversion

So that you can also view the events that are now forwarded to GA4 as conversions, you must also create them as such under Configure -> Conversions. You do this via the "New conversion event" button. Enter "hubspot_form_submission" as the event name.

Google Analytics 4 Events als Conversion markierenDone: With these steps, you should be able to track embedded HubSpot forms as conversions within your GA4 property without many problems.

FAQ on the topic of HubSpot conversion tracking

To conclude this article, we will address a few questions that frequently arise in connection with conversion tracking. If you have any further questions, we at EXWE will be happy to answer them over the phone.

  • What is a conversion anyway?

    A conversion is a term used to describe when a person performs a desired action on a website or app, such as making a purchase or filling out a form. This term is often used in the context of marketing, where the goal is to get people to perform a certain action on a website or app. In this context, a conversion is a way of measuring the effectiveness of a marketing campaign or website design in terms of how well it is able to persuade people to take a desired action.

  • Google Universal Analytics VS GA4

    Google Analytics is a web analytics service offered by Google that tracks and reports website traffic. There are two versions of Google Analytics: Universal Analytics and the newer and, from mid-2023, exclusively supported version.

    Universal Analytics is the older version of Google Analytics and uses a JavaScript snippet to track website visitors and collect data. This data is then used to create reports that help website owners understand how their visitors are interacting with their website.

    GA4 is the newer version of Google Analytics. GA4 can also be implemented in the classic way via a JS snippet or, for example, through the GoogleTagManager. GA4 uses machine learning to automatically identify important trends and insights in your website's data and offers advanced tracking and reporting features compared to Universal Analytics.

    One of the main differences between Universal Analytics and GA4 is that GA4 is designed to be more user-friendly and intuitive, with a focus on automated insights and predictive analytics. It also offers greater integration with other Google products and services, such as Google Ads and Google Cloud. Universal Analytics is currently still widely used, but from mid-2023, no new tracking data will flow into this phased-out environment.

  • What is HubSpot actually?

    HubSpot is a customer relationship management (CRM) platform that provides a suite of tools for managing customer interactions, including marketing, sales and customer service. It is designed to help businesses grow by attracting, engaging and delighting customers. HubSpot offers a range of products, including free and paid options, to meet the needs of different businesses. Key features of the platform include email marketing, live chat, marketing automation and sales tracking.

What is your project? If you want to tell us about it, we'll call you back!

 
Meike
Meike
from 07.11.2022

Hello, my name is Meike. I take care of the EXWE back office and am responsible for our social media channels. All of our articles are meant to make your life easier and help you make decisions. Nevertheless, it can happen that something remains unclear, so: If you have questions about this article you can easily reach me at +49 231 93149827.

You always want to stay at the cutting edge of technology Don't miss any more news and blog posts.
We also have the following interesting posts from our tech blog for you on this topic
Successfully create & optimize SEA & PPC accounts

The ultimate step-by-step guide for online stores. Optimize your GoogleAds account and use Search Engine Advertising for your business.

Why your online store will benefit from SEA

And why search engine advertising is so important in e-commerce and for your store - Professional SEA management for your successful e-commerce.