Google Analytics is a free comprehensive tool that allows you to track your web traffic and data.
Google Analytics will show you how many people visit your site, individual pages, conversions, and how people interact with your content. This data is critical for the optimization of your website.
There are two types of Google Analytics code.
You may be accustomed to the Google Universal Analytics (UA) code. This is being sunsetted and replaced with Google Analytics 4 (GA4).
GA4 is much more customizable and applies to websites or apps, whereas Google UA can only be applied to websites.
Setting Up Google Analytics On Your Website
The first thing you will want to do is set up your free Google Analytics account.
You will be prompted to sign in with a Gmail account. Once you do that, you will be logged in.
Select the button that says Start Measuring.
The next screen will have you create an account name. You can track more than one site under one account, so you might want to use something broad, such as the name of your business.
Next, you will want to set up properties. This should include the name of your website, the time zone, and the currency used for this business’s location.
The next screen will ask a little bit about your business and how you intend to use Google Analytics.
Click on the terms of the agreement and select email communications, and you will be taken to the admin dashboard.
Next, you will want to set up the data stream.
When adding Google Analytics to a WordPress site, you will want to select “web stream.”
You will next add your site’s URL and the site’s name.
Once you hit the Create Stream button, you will see the stream name, stream URL, stream id, and measurement id.
The measurement id is what you will use to add to your website.
Adding Google Analytics To Your WordPress Website
There are three different ways to add Google Analytics to any WordPress site.
The best option for you will depend on your comfort level with making changes to your website code.
The first option uses a WordPress plugin to add Google Analytics to your website without requiring coding.
The second option uses a WordPress plugin with a small amount of code required to be copied and pasted.
The third option requires you to edit the code in the theme files of your website.
1. Using The Google Analytics Plugin
The easiest way to add your Google Analytics tag code to WordPress is with a plugin.
Google Analytics for WordPress by MonsterInsights is the most popular and makes it simple to add your Google Analytics code to your site.
The free version should work perfectly fine unless you want advanced tracking and reporting features. Then you would want to upgrade to the pro version.
You are all set up now, and you will now see Insights in your WordPress dashboard. Reports, Settings, and any other selected tools are now visible in the WordPress dashboard.
2. Using The Header/Footer Script Plugin
The second way to install your Google Analytics tag is with a header/footer plugin.
This method is especially helpful if you want to track different metrics for different pages, as it can be used on specific pages and the entire site.
WPCode Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager is the most popular plugin to insert header and footer code with over 1 million users.
3. Add Google Analytics Code Snippet Directly To The Header.php File
If you are comfortable working directly in your theme code, this is another option for adding your Google Analytics code. Keep in mind that you are directly changing the theme files, so if you change or update your theme, you will lose your Google Analytics code and will need to re-add it every time you update or change the theme.
WordPress theme files, August 2022
Verifying Your Google Analytics Tags
Once you have your Google Analytics tag installed on your website, you can use the Tag Assistant (Legacy) by Google Chrome Extension to check that your Google Analytics tag is installed and working correctly.
Simply install the Chome extension on your browser, navigate to the WordPress site that you installed Google Analytics on, and it will tell you which tags are present on the site and if there are any errors.
Once Google Analytics Is Installed On Your WordPress Site
Once your Google Analytics tag is installed, you can view the dashboard through the Google Analytics site.
Alternatively, if you selected the MonsterInsight plugin method of installing Google Analytics on your WordPress site, you can view the reports and data from right within your WordPress dashboard.
Google Analytics is a powerful tool to help you understand how visitors are getting to and using your website, how well pages are converting, how many users are visiting your website, and so much more.
Adding the Google Analytics tag to a WordPress site is simple, using one of these three methods:
You can use the data from Google Analytics to gain valuable insights into your website traffic which will allow you to make improvements.
It’s worth noting that Google Analytics cannot collect data retrospectively, so it’s important to add Google Analytics to your website sooner rather than later to avoid missing any data.
This content was originally published here.