How to track your visitors on your website?

What is Google Analytics 4 ?

Firstly, if you are a website owner, regardless of the content you offer, it is imperative to determine the most valuable pages to your audience. This knowledge will assist in directing your efforts in the right direction, from blogs to e-commerce sites.

The question is, how can one track the audience’s activity on their website? The answer is simple: Google Analytics. It is a free platform provided by Google that monitors traffic, interactions, conversions, and more.

Furthermore, Google Analytics 4 (GA4) is an enhanced version of Google Universal Analytics. If you are creating a new Google Analytics account, it is advisable to start with GA4 instead of Universal Analytics. This recommendation is because Google is promoting the newer system, which will ultimately replace the older one. By embracing it early, you will become proficient in its use more quickly. It is not a question of “if” but rather “when” the transition to GA4 will take place.

Steps involved to get going with your GA4 account.

1. Acces Google Analytics Platform

To do this, please access which will take you to the main page. Upon arrival, you will be greeted with the following view:

  • Create an Account Name. It can be set to whatever you want, as it will be shown only to you.
  • Enter a desired Property Name, along with your time zone and used Currency. Usually the name of your website should be filled in.
  • Select your Industry Category. You can select Other, unless you can find a match for your business.
  • Business size: You can usually go with Small ( 1 to 10 employees )
  • How do you intend to use Google Analytics with your business? Select whichever option you are most interested in.
  • Click Create
  • Accept the Terms of Service Agreement

2. Setting the Data Stream

The next step is to set up a data stream to start collecting data.  GA4 works with either both Web and Apps, or just one of them. We will choose Web, since we are setting GA4 to run on our WordPress site.


After clicking on the Web icon, you will be prompted with the following window. You will be asked to fill in the name of your website as well as the Stream name

After clicking the Create stream button, a new window will pop up, containing several pieces of inormation that we are going to use to set up our GA4 property. It is worth mentioning that here is where we come in contact for the first time with Google Tag manager. Needless to say, you will need to head over to and create an account there as well.

3. Creating a Google Tag Manager account.

After clicking the Create Account button, you will be prompted with a new window.

  • Set up your Account name. This can be set to whatever you want.
  • Insert the name of your Country
  • Set the container Name. This can be set to whatever you want as well. A container is basically the workspace where you will create and manage your tags,
  • Select your target platform which is Web in our case.
  • Click Create
  • Accept the Data Processing Terms as required by GDPR.

4. Installing Google Tag Manager onto your WordPress site.

The next step is crucial. Don’t worry, this step does not involve any coding skills. Assuming you are using WordPress, since this tutorial is tailored for those who seek help installing GA4 and GTM ( Google Tag Manager ) on a WordPress based site.

This code can be copied to the header of your theme, but this means the code will get deleted each time the theme gets an update. And depending on the theme you have, that can happen really often. 

I found out that the easiest way is to do this with the help of a Free plugin. Head over to your website and look for a plugin called “Code Snippets“. 

Please proceed to install and activate it. You will find it in the left admin bar, under the name of Snippets. Hover over it and select the Add New option.

Copy and paste the following code to the text area.

					add_action( ‘wp_head’, function () { ?>


<?php });

After you copy the code from your google tag manager, it should look something like this:

					add_action( ‘wp_head’, function () { ?>
<!– Google Tag Manager –> <script type="litespeed/javascript">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=!0;j.src=‘https:})(window,document,’script’,’dataLayer’,’GTM-XXXXXXX’)</script> <!– End Google Tag Manager –>
<?php });


Name the Snippet something like: Code for Google Tag Manager and than save it.

What you’ve essentially done is created a code that will be added to the header.php file. Because this code is inserted from the outside of the theme’s files, it will be there no matter how many times the theme updates or gets changed by the site administrator. 

5. Creating the tracking tag in Google Tag Manager

Head back over to your Google Tag Manager platform. You now want to create your tracking tag that will send data towards your Google Analytics 4 property. Click on Tags and select New. 

  • Name your tag in the top left corner something like ” Google Analytics 4 Tracking Tag “.
  • Click on the first box section, the one called Tag Configuration. A side menu will appear, containing multiple Tags. The one we are interested in is the second one, called Google Analytics: GA4 Configuration.
  • In the Measurement ID, you will need to copy paste the code from Google Analytics.

In case you have trouble finding this window in Google Analytics, you can click on the small cog wheel from the bottom left corner which is called Admin -> Property Settings and select Data Streams. There you’ll see the Web data stream that you’ve created earlier.

6. Just about done.

  • Copy Paste the Measurement ID to your “Measurement ID” field.
  • Click on the next box, called “Triggering”. This is basically the event that will fire the tracking tag that we’re setting.
  • Select the ” All Pages ” one.
  • Click save!

7. Time to test it out!

Google Tag Manager offers us the possibility to test everything before we get to publish. In the top right corner you can see two buttons. One is Preview and the other is Submit. Obviously we want to preview our work, so go ahead and click on it.

Fill in your website URL and click Connect. A new window will be created with the URL of the page you’ve inserted.

Your tracking tag should be fired by the page view from the preview mode.

In conclusion:

Google Tag Manager provides a range of benefits for your website. By allowing you to manage multiple tracking codes and marketing tags in one place, it simplifies the tracking process and saves you time. Additionally, it enables you to customize and optimize your website’s tags and events, leading to improved user experiences and higher conversion rates. The ability to test and refine your tracking without the need for coding skills is another significant advantage. Overall, incorporating Google Tag Manager into your website can enhance your marketing efforts and help you achieve your business objectives.

This was a simple integration of Google Analytics 4 tracking for your WordPress site, with the help of Google Tag Manager.

Get in touch with us.

Intră în legătură cu noi.