How to set up event tracking using Google Analytics 4 and Google Tag Manager

How to set up event tracking using Google Analytics 4 and Google Tag Manager

7th September 2022

Soon we will be saying farewell to Universal Analytics and making way for Google Analytics 4; with just over a month to go (July 2023) – now is the perfect time to brush up on some Google Analytics event tracking skills. Google Analytics 4 is the ideal tracking tool for beginners since the software has some built-in measurements, meaning no need to configure them yourself! 

Showcasing Google Analytics 4 at Bopgun

If Dexter can do it, anyone can!

So what is an event, and why track one?

An event can be any activity on your webpage, for example, when someone clicks a link or scrolls down a page. Event tracking on Google Analytics is very beneficial for seeing how users approach your website, thus helping marketing strategies. 

Similarly to Universal Analytics, GA4 includes some of the basic Automatically Tracked Events. These are: 

  1. first_session (when a visitor lands on the website for the first time)
  2. session_starts (every time a new session starts on the website)
  3. user_engagement (fires when a visitor spends at least 10 seconds on a page and then goes onto another page on the website).

An exciting new feature included in GA4 is Enhanced Measurement. Turning this on is simple and allows you to track events on your webpage without configuring them. 

How to set up Enhanced Measurement?

  1. First, go into Google Analytics and click on Configure on the sidebar. Then, at the bottom of the page select Admin.Step one of setting up Enhanced Measurement in Google Analytics 4
  2. Select Data Streams from the menu and choose your website. Step two of setting up enhanced measurement in Google Analytics 4
  3. Then this menu will show with the option to turn on Enhanced Measurement. There’s also the option to turn off individual measurements by selecting the settings button on the right. Step three of setting up Enhanced Measurement in Google Analytics 4

 

Press save, and now your website is tracking some helpful events; in just a few clicks! But what if you want to be more specific with your tracking? Intrigued by how many people click on your social links? The Custom Events option allows you to track almost anything!

Generously, Google also introduced Recommended Events: a selection of worthwhile custom events to track based on your company’s needs. These are readymade with a parameter but have to be configured yourself.

 

How to configure a custom event on Google Analytics 4 using Google Tag Manager?

In this guide, I used Google Tag Manager to incorporate events into Google Analytics 4. In my example, I set up a Custom Event tracking the number of clicks received on our LinkedIn button.

  1. Open Google Tag Manager and click on Variables. Step one of setting up a custom event in Google Analytics 4
  2. Once in Variables, click Configure and ensure that the Clicks are selected. Step two of setting up a custom event in Google Analytics 4
  3. Next, exit out of this and click Preview in the top right corner and insert the URL of your website. Now Tag Assistant is connected.
  4. Return to your website in Preview mode, and click the button you want to track. For me, I clicked on the LinkedIn button. 
  5. Go to Tag Assistant, and on the sidebar, there should be a Link Click, the button you have just pressed in the Preview. Go to Variables. Since I want to track the number of clicks, I have copied the section by Click Classes. I have highlighted this below. Keep this copied. 
  6. Return to Google Tag Manager and click on Triggers on the sidebar, then New to configure a new trigger. Our trigger type will be ‘Click – Just Link’.’ Since I only wanted to track the LinkedIn link, I have also selected ‘Some Link Clicks’.
  7. Now select Click Classes and paste in the section we previously copied. Mine looked like the image below. I have named mine GA4 LinkedIn but call your trigger whatever fits your event. Make sure to save this.
  8. Go to Tags and New, then select Tag Configuration.
  9. When selecting the ‘Tag type’, click ‘Google Analytics: GA4 Event’ (you must configure GA4 before if you haven’t), then click your GA4 configuration tag. The value should be ‘Click URL’ since we are tracking when users click our LinkedIn link.
  10. Select the trigger previously made, then select save. Your event is officially set up!
  11. To double-check this, exit your previous Preview Session on Google Tag Manager and open a new one. Click your button and watch it fire in Tag Assistant!

 

How to create a Custom Dimension in Google Analytics 4?

So that your new event shows up in your reports on Google Analytics, you must create a Custom Dimension.  This is a simple step but crucial to ensure the event is visible in your data! To do this:

  1. Go onto Google Analytics, and select Configure and Custom Definitions. After, create a new Custom Dimension. I named my dimension the LinkedIn button.
  2. Return to Google Tag Manager and our LinkedIn tag, copy the Parameter name and paste it into our dimension on Google Analytics under the Event parameter and save.

All done! Don’t worry if you can’t see your event on Google Analytics instantly; it may take up to 24 hours for the data to show.

If you need a hand setting up custom event tracking in Google Analytics 4, don’t hesitate to get in touch.

 


Sky-rocket your insights by reading our blog on the secrets behind a great website.

Privacy Policy

This website is operated by Bopgun and whose registered address is Unit 4 Corum 2 Crown Way, Warmley, Bristol, England, BS30 8FJ (“We”) are committed to protecting and preserving the privacy of our visitors when visiting our site or communicating electronically with us.

This policy sets out how we process any personal data we collect from you or that you provide to us through our website. We confirm that we will keep your information secure and that we will comply fully with all applicable UK Data Protection legislation and regulations. Please read the following carefully to understand what happens to personal data that you choose to provide to us, or that we collect from you when you visit this site. By visiting bopgun.com (our website) you are accepting and consenting to the practices described in this policy.

Types of information we may collect from you

We may collect, store and use the following kinds of personal information about individuals who visit and use our website:

Information you supply to us

You may supply us with information about you by filling in forms on our website. This includes information you provide when you submit a contact/enquiry form. The information you give us may include your name, address, e-mail address and phone number.

Information our website automatically collects about you

With regard to each of your visits to our website we may automatically collect information including the following:

  • technical information, including a truncated and anonymised version of your Internet protocol (IP) address, browser type and version, operating system and platform;
  • information about your visit, including what pages you visit, how long you are on the site, how you got to the site (including date and time); page response times, length of visit, what you click on, documents downloaded and download errors.

Cookies

Our website uses cookies to distinguish you from other users of our website. This helps us to provide you with a good experience when you browse our website and also allows us to improve our site. For detailed information on the cookies we use and the purposes for which we use them see our Cookie Policy.

How we may use the information we collect

We use the information in the following ways:

Information you supply to us. We will use this information:

to provide you with information and/or services that you request from us;

Information we automatically collect about you. We will use this information:

  • to administer our site including troubleshooting and statistical purposes;
  • to improve our site to ensure that content is presented in the most effective manner for you and for your computer;
  • security and debugging as part of our efforts to keep our site safe and secure.

This information is collected anonymously and is not linked to information that identifies you as an individual. We use Google Analytics to track this information. Find out how Google uses your data at https://support.google.com/analytics/answer/6004245?hl=en.

Disclosure of your information

Any information you provide to us will either be emailed directly to us or may be stored on a secure server located in London. We use a trusted third party website and hosting provider (AWS) to facilitate the running and management of this website. AWS meet high data protection and security standards and are bound by contract to keep any information they process on our behalf confidential. Any data that may be collected through this website that we process, is kept secure and only processed in the manner we instruct them to. AWS cannot access, provide, rectify or delete any data that they store on our behalf without permission.

We do not rent, sell or share personal information about you with other people or non-affiliated companies.

We will use all reasonable efforts to ensure that your personal data is not disclosed to regional/national institutions and authorities, unless required by law or other regulations.

Unfortunately, the transmission of information via the internet is not completely secure. Although we will do our best to protect your personal data, we cannot guarantee the security of your data transmitted to our site; any transmission is at your own risk. Once we have received your information, we will use strict procedures and security features to try to prevent unauthorised access.

Third party links

Our site may, from time to time, contain links to and from the third party websites. If you follow a link to any of these websites, please note that these websites have their own privacy policies and that we do not accept any responsibility or liability for these policies. Please check these policies before you submit any personal data to these websites.

Your rights – access to your personal data

You have the right to ensure that your personal data is being processed lawfully (“Subject Access Right”). Your subject access right can be exercised in accordance with data protection laws and regulations. Any subject access request must be made in writing to Data Controller, Bopgun Design, Studio 12a Greenway Farm, Bath Road, Wick, Bristol BS30 5RL. We will provide your personal data to you within the statutory time frames. To enable us to trace any of your personal data that we may be holding, we may need to request further information from you. If you have a complaint about how we have used your information, you have the right to complain to the Information Commissioner’s Office (ICO).

Changes to our privacy policy

Any changes we may make to our privacy policy in the future will be posted on this page and, where appropriate, notified to you by e-mail. Please check back frequently to see any updates or changes to our privacy policy.

Contact

Questions, comments and requests regarding this privacy policy are welcomed and should be addressed to studio@bopgun.com.