There are many ways to integrate Google Analytics into a WordPress website. However, I considered the following two to be the simplest and quickest for beginners.
Step 1: Create a Google Analytics account (FREE)
Signing up for Google Analytics is uncomplicated and completely free. Go to https://analytics.google.com/ and click the set up for free button.
Step 2: Choose the form of property, such as a website or an app.
Add a name for your website’s account and review all of the data-sharing options before clicking Next.
Step 3: Enter your property’s details.
In this step, you must enter the name of your website as the Property name, the reporting period, and the currency in which your company operates.
This will allow you to produce reports based on your time zone and currency, which will assist you in making sound business decisions.
Right now, To configure the Universal Analytics Property for your website, click on “Show advanced options.”
If you skip this move, Google will instal the new GA-4 version on your website automatically. (Because of difficulties in installation and data collection, this is not yet recommended.)
Google Analytics 4 is a new edition of Google Analytics. This is supported by AI-powered insights and offers more granular data, i.e. more comprehensive website analytics, to help you develop your company.
In the advanced choices, enter your website URL and choose to Create a Universal Analytics property only, as shown below, before clicking Next.
You will have the option to pick a few more items relevant to your company in the following browser. This includes the industry, business size, and how you plan to use Google Analytics for your company.
Choose what relates to your company and then click Create to add a new property to Google Analytics.
Step 4: Retrieve the tracking code from the Google Analytics dashboard.
The tracking code and tracking ID for your Analytics account will be shown in the following window, as seen in the screenshot below.
Step 5: Navigate to Appearance>Theme Editor in the WordPress dashboard.
We’re just a few steps away from using WordPress to monitor our Google Analytics results. When you get to your WordPress dashboard, go to the Appearance menu and then to the Theme Editor.
Step 6: On the right side of the dashboard, look for header.php.
Click on the Theme Header in the Theme Files menu on the right side of the dashboard.
You can not see header.php if your child theme inherits data from a parent theme. To update the parent theme, click on “Select theme to edit:” just above where the theme files are shown.
Now, on the main screen, locate head> and paste the copied script from the previous stage, then click Update File.
Google Analytics has now been installed on your WordPress website. After 48 hours, you should be able to see data in the Google Analytics dashboard. That sounds like a whole lotta work, right???