Slava Wagner – SEA, CRO, Data & Forecasting

Installing Google Analytics 4 (GA4) on WordPress with Head, Footer and Post Injections

Google Analytics 4 (GA4) was rolled out in 2021 and will be the new standard in Google tracking from 2023. The new system comes up with an unprecedented range of functions , but is correspondingly more complex to operate. A particular advantage of Google Analytics 4 (GA4) is the very precise, cross-browser and cross-device recording of active users – and the tracking of users using a standard user ID instead of a standard client ID as in Google Analytics 3. This allows you, for example, to track exactly how many users have filled out a contact form, because you count each user as exactly one counter as an active userwhen you call up the thank you page or the tracking URL.

Google Analytics 4 (GA4) includes numerous features that were previously only available in Looker Studio (formerly Google Data Studio) or Google Tag Manager, such as button click tracking from Google Tag Manager or reporting from all dimensions and metrics with a drag-and-drop report editor known from Google Looker Studio (formerly Data Studio). None of this existed in the old Google Analytics 3 (Universal Analytics).

In addition, with Google Analytics 4 (GA4) it is possible for the first time to create multiple nested conversion actions . For example, you can specify various conditions for reading a conversion event, such as only users who came from YouTube videos and made an order or submitted a contact form being recorded as a conversion.

Also exciting: The bot filters of Google Analytics 4 (GA4) are even more sophisticated than those of Google Analytics 3. This means: When evaluating recorded access numbers, you can be even more certain that an active user has been recorded on a URL is – this one is really real.

Instructions: How to install Google Analytics 4 (GA4) on WordPress websites

First create a new account with Google Analytics 4 (GA4). Enter your information there, enter your website URL and complete the process. Then go to administration and click on data streams in the right column.

Click on “Streams” on the right column in Google Analytics 4 (GA4) admin settings to get the tracking code for Google Analytics 4 (GA4) installation on WordPress.

Step 1: Copy tracking code from Google Analytics 4 (GA4)

Then click on the menu item “ View tag instructions ” at the bottom. 

Now click on “View tag guide” at the bottom to get the Google Analytics 4 (GA4) tracking code and install it on WordPress.

Now go to the “ Install manually ” menu tab above and then copy the Google Analytics 4 (GA4) tracking code.

Copy the Google Analytics 4 (GA4) tracking code to install it on your WordPress website.

Step 2: Install Google Analytics (GA4) tracking code in WordPress

Then install the Head, Footer & Post Injections WordPress plugin on your WordPress website . This will allow you to install your Google Analytics 4 tracking code you just copied onto your WordPress website. Once the WordPress plugin is installed, go to the plugin in the left menu bar on the WordPress dashboard and paste your Google Analytics 4 (GA4) tracking code in the <head> area .

It is also important to note that this installation method is better than installing the Google Analytics tracking code directly into cookie banner privacy tools such as Complianz or Borlabs. Data protection plugins are located in the body area of ​​the website. However, the tracking code must be in the head area. Only when the tracking code is in the head section of the website can you automatically sync Google Analytics with Google Search Console to track your organic rankings and organic Google search clicks.

Install the Google Analytics 4 (GA4) tracking code you copied earlier into the head section of your WordPress website using the Head, Footer and Post Injections WordPress plugin .

Step 3: Set up data retrieval from Google Analytics 4 (GA4) GDPR-compliant with Complianz

The last important step when installing Google Analytics 4 (GA4) on your WordPress website is to make data retrieval from Google Analytics privacy compliant. This means: The website visitor may only be tracked if he has expressly consented to third-party data processing in the cookie banner. Your cookie banner must also contain a decline button. 

This means: You should prevent tracking with Google Analytics until the user has given explicit consent in the cookie banner. This is possible with the high-performance data protection plugin Complianz for WordPress. In these instructions , you will learn how to set up the data protection plugin Complianz in WordPress and how you can prevent data retrieval from Google Analytics 4 (GA4) in the Complianz Script Center until the user has consented to the data processing in the cookie banner. To do this, simply store the URL of Google Analytics and Google Tag Manager in the Script Center from Complianz to block the delivery of the data retrieval prior to approval in the cookie banner.

Store URLs from Google Analytics and Google Tag Manager in the Complianz Script Center to block the data retrieval of the two applications before consent to data processing in the cookie banner.

Important: With a GDPR-compliant GA4 installation, often only 1/3 of the traffic is recorded

The bounce rates on websites are often a good 50%. If only users are tracked by Google Analytics 4 (GA4) who explicitly agreed to the data processing in the cookie banner, these 50% fall off the grid in the data measurement . In addition, there are users who clicked on the reject button or clicked away the cookie banner – this option must also be given, because with the exception of the press, other industries are not allowed to make website use dependent on a decision in the cookie banner. If a user clicks away the cookie banner, then he may not be tracked either and this is automatically interpreted as a rejection of third-party data processing . Only the explicit consenton third-party data processing may justify third-party tracking.

So if you want to analyze how many users you really have on the website, where they come from and how they interact with your website, Google Analytics 4 (GA4) is only partially helpful. You mainly need Google Analytics 4 (GA4) to collect and synchronize target group data for Google Ads. You can also use Google Analytics to record conversion data for Google Ads in conversion tracking , which makes Google Ads even stronger in algorithmic learning when finding users who are likely to convert.

However, as far as the pure  analysis of website users is concerned, Google Analytics 4 (GA4) is no longer sufficiently suitable under the current conditions for GDPR-compliant implementation , since – as mentioned above – often only 1/3 of the previous traffic is still used is recorded  or may be recorded.

For pure analysis purposes, it would therefore make more sense to track users with Matomo on the server side and without cookies , because no consent is required in the cookie banner for this, since firstly no cookies are set and secondly no third-party data retrieval takes place and only we have access to the have data. Matomo is the most widely used application for server-side and cookie-free tracking, is completely safe and reliable, as well as being open-source and free  You can find out how the installation works in this guide.

Installing Google Analytics (GA4) on WordPress

If you have questions about the installation of Google Analytics 4 (GA4) on WordPress, or don’t know how to configure data retrieval in the cookie banner, feel free to ask:

Ask your question

info@slavawagner.de

Overview

Install Google Analytics 4 (GA4) on WordPress

  1. Create a new Google Analytics 4 (GA4) account.
  2. Get tracking code for installation: Go to Google Analytics 4 (GA4) administration, click on “Data streams”, go to “View tag guide”, then go to the menu tab “Install manually” and copy the tracking code from Google Analytics 4 (GA4).
  3. Install tracking code on WordPress:  Paste the copied tracking code into the head section of your WordPress website, for example with the Post, Head and Footer Injections plugin.
  4. GDPR: Configure the retrieval of Google Analytics 4 (GA4) in the Complianz Script Blocker.

Ask your question

info@slavawagner.de

Overview: Installing Google Analytics 4 (GA4) on WordPress websites

If you want to install the Google Analytics 4 (GA4) tracking code on your WordPress website, a safe and easy method is to use the Head, Footer and Post Injections WordPress plugin . This plugin allows you to insert code snippets and tracking codes in the website header, footer or post area. To add the GA4 tracking code, you should first create a GA4 account and get the tracking ID. Then go to your WordPress site’s dashboard and under “Settings” select the “Head, Footer and Post Injections” box. Now paste the tracking code in the head area and save changes. After installation, it will automatically start recording in the Google Analytics 4 (GA4) real-time report.

FAQ - Summary on the topic: Installing Google Analytics 4 (GA4) on WordPress

Here you will find a summary of important and frequently asked questions on the topic: Installing Google Analytics 4 (GA4) on WordPress

With Google Analytics 4 (GA4) you can track your website visitors, view page views, view user acquisition sources, track average session lengths, track goals (conversions), and export these goals to Google Ads so the algorithm can find more similar users, to generate even more conversions.

Google Analytics 4 (GA4) lets you track conversions: Conversions are goals triggered by online users on your website. For example, this can be a submitted contact form that you can track with the URL of a thank you page. You can import these conversion actions into Google Ads so you can see which campaign is getting you the most returns and allow the algorithm to find more similar users who are also converting. You can also record target group data with Google Analytics 4 (GA4) – for example at the level of the URL of a specific product or service page.

When implementing the Google Analytics 4 (GA4) tracking code on your website, you should ensure that the tracking is not triggered on the website before the user has given their consent to third-party data processing in the cookie banner. You can achieve this by installing the data protection plugin “Compliance” on WordPress. In the Complianz Script Center you can block the URL of the query from Google Analytics 4 (GA4) before agreeing to the cookie banner.

With GDPR-compliant implementation of Google Analytics 4 (GA4), many website visitors are no longer recorded, which is why you can only see part of the real traffic on your website. Websites often have bounce rates of 50%-70%, and if users are not allowed to be tracked until they have given consent to third-party data processing using Google Analytics 4 (GA4), they fall completely off the grid and are not tracked at all. In addition, users who clicked “decline” in the cookie banner and users who clicked away the cookie banner are not recorded.

You might also be interested in:

Schema markups for FAQ questions: More clicks from organic Google search

To have a chance get into the related questions section at the top of Google Search, you can set up your answered questions with FAQ schema markup.

How to install the AMP integration on WordPress websites according to GDPR

With the AMP integration you can get up to 25% more organic impressions in search engines on your website.