We have several marketing campaigns and naturally we wanted to track how different campaigns work. There are mainly two goals in our marketing activities:
- To get contact requests.
- To get new users to our SaaS tool. We have a free trial so basically newcomers can just create an account and start using the tool.
Before getting to know Google Tag Manager (GTM), I was able to set Google Analytics goals solely to page visits and creating events straight to the source code was not an option for me. In our contact requests we didn’t have a thank you page so basically I was able to track which campaigns generated visits to Contact-page but I was blinded when it came to the actual requests and form fills.
Solution and step by step instructions
GTM is our solution.
Yeah Yeah, you might have known for a while that GTM is the solution for these kind of problems, and I did too, but somehow I just hadn’t taken the time to get to know Tag Manager. So if you are struggling with similar problem, here is a simple guide on how to track contact requests with GTM.
I assume that you have set up your GTM account and inserted GTM script to your web page. This blog post doesn’t cover those topics. We go straight into action.
1) Turn on Google Tag Manager preview mode
Login to your GTM account and on top of the screen you will find preview mode. Turn on the preview.
After activating preview mode, you will see GTM panel at the bottom of the browser window when browsing through your sites. If you can’t see the panel, check that the GTM script is properly inserted to your source code.
In tags tab, you can see all the tags that are fired in this specific page that you are currently viewing. In the picture above can see that we have Google Analytics tracking code, Facebook pixel, Hello Bar, Hotjar, Hubspot tracking code and LinkedIn Pixel added via GTM and those Tags fire when the page loads.
2) Press the button that you want to track
In my example case, I wanted to track when a visitor pushes Send a contact request -button in our contact form.
Now go ahead and push the button you want to track and you will notice a new Data Layer appearing to the left hand side of the GTM panel. In my case, gtm.formSubmit appeared after pressing the button.
Press the layer that appeared and choose Variables tab on top of the panel and you see all the different variables in this certain Data Layer.
3) Choose a variable to work with
I decided to use Form ID Variable since GTM offers a readymade trigger type called form submission where you can set Form ID as trigger. It doesn’t get easier than this!
We are using Hubspot to create forms and we use Form ID’s to embed certain forms to our website, so working with Hubspot Form ID’s was natural option for me.
4) Create a Trigger in Google Tag Manager
Go to your GTM account, choose Triggers, and start creating a new trigger. You should end up in similar view that in the picture below.
In trigger configuration, choose Form Submission.
Note: I created a Custom Event by using _event variable which worked also, but why create custom events when GTM has different premade trigger types to save your time? So everything is possible, but I suggest using Form ID.
Your view will change to the one below. Give your trigger a descriptive name. As a default All forms is chosen. Choose Some forms and you’ll get more options.
I decided to add two conditions to my trigger because we might use one Hubspot form in different pages – so the same Form ID may appear in different pages – and I want this trigger to fire only in a certain page.
If you can’t find Form ID in the drop-down menu, you need to activate it. Read more about Built-In Variables and how to activate them.
5) Create a Tag in Google Tag Manager
Go to your GTM account, choose Tags, and start creating a new tag. You should end up in similar view that in the picture below. If you wish a contact request to appear in your Google Analytics, choose Universal Analytics as Tag type. Choose Track Type to be an Event and you will find Contact Requests in Event section of Google Analytics.
What are event tracking parameters?
Events are sorted according to event tracking parameters in Google Analytics. To give you an example, we have three different types of contact requests in different parts of our website and all of these have three language versions:
- Demo request
- Regular contact request and
- Integration request
For each language version, I create separate Trigger and I group them to one Tag (the one specified above).
Category parameter for Demo request, contact request and integration request will be the same in order to review all contacts in general.
Action parameter will be named after each action in this example.
Label will be the address of the site where the tag fires. But this was just a test and not that useful since I had already set Triggers to specific pages only.
Parameters can basically be anything and it’s up to you how you want to group your events. Keep in mind though that you AND your colleagues should understand your naming.
6) Set Tag Manager events as goals in Google Analytics
Now we are in the final step. You have set proper Triggers and Tags in GTM and you have managed to bring Events to Analytics.
Head to your Google Analytics account > go to Admin > and under view choose goals. Either create new goal or modify some of the old goals.
Set Goal Setup as Custom. Under Goal Description give your goal a representational name (this name will be visible in Goals section of GA) and choose Event as a Goal Type.
In Goal Details you can choose which event to track as GA goal. These are exactly the same parameters that you have just set in Tag Manager. It would have been enough to add only Action parameter, but as an example, I filled Category also.
I didn’t add any value for the Event so there is no need to use Event value as the Goal Value for the conversion. However, you should add a value to Events whenever it is possible.
Go to Google Analytics > Conversions > Goals > Overview to see how may times your forms have been filled.