3 Simple Ways To Setup Google Analytics For WordPress

Setting up Google Analytics and adding its tracking code on your WordPress website is critical for gathering website visitor data and understanding your customers’ digital consumer journeys. For example, you can use data in Google Analytics to determine which pages your customers visit on your website prior to making a transaction.

To set up Google Analytics on your WordPress website, you can use one of the following three options:

  1. Use a WordPress Plugin

The most simple and fastest way to set up Google Analytics code on your website is by using a WordPress plugin. Our go-to plugin for Google Analytics and WordPress integration is Google Analytics Dashboard Plugin for WordPress by MonsterInsights.

To install and activate MonsterInsights on your WordPress website, search for MonsterInsights in the plugins section and click on Install Now and then Activate.

Google Analytics WordPress

Once you’ve installed MonsterInsights, go to Insights > Settings. You can connect your WordPress website with your Google Analytics clicking on Connect MonsterInsights and take the required steps to connect the two accounts.

a. Click on Connect MonsterInsights

b. Select the type of website you have (e.g. business website) 

Google Analytics MonsterInsights

c. Select the email address associated with your Google Analytics account

Google Analytics MonsterInsights

d. Allow MonsterInsights to have access to your Google account

Google Analytics MonsterInsights

e. Select the Google Analytics associated with your website and complete connection

Google Analytics MonsterInsights

f. Once connected, you’ll see your Google Analytics under the Google Authentication section.

Google Analytics MonsterInsights

2. Add Global Site Tag (gtag.js) in the Header.php File

You can also add your Google Analytics tracking code by adding your Google Analytics account’s Global Site Tag (gtag.js) in the header.php file.

To do so, first go to the admin section of your Google Analytics account and click on Tracking Info and then Tracking Code.

Google Analytics Global Site Tag

Then, copy the Global Site Tag (gtag.js).

Google Analytics Global Site Tag

After, go to appearance > Theme Editor > Theme Header and insert the tag before </head>.

Google Analytics Header

3) Use Google Tag Manager

You can add Global Site Tag (gtag.js) without accessing the header.php file by using Google Tag Manager.

To do so, first click on Tags and Tag Configuration.

Google Tag Manager Google Analytics

Then, select Google Analytics: Universal Analytics.

Google Tag Manager Google Analytics

Select Pageview as tag type and add a new variable for Google Analytics settings.

Google Tag Manager Google Analytics

Add your Google Analytics tracking code.

Google Tag Manager Google Analytics

Select All Pages as a trigger.

Google Tag Manager Google Analytics

Lastly, save the trigger and click on Submit and you’re good to go!

Google Tag Manager Google Analytics

Integrating your Google Analytics account and WordPress correctly is critical to measuring your website performance. By connecting your Google Analytics account with your WordPress website using one of the three options above, you can analyze online behaviours, perform data mining, or website trends. These insights will help you further optimize your website and digital marketing campaigns!

If you want help with setting your Google Analytics account for your WordPress website, please get in touch below and we’ll be more than happy to help!

Get In Touch

Contact Us

We are here to help you 7 days a week. If you have any questions or want to say ‘hi’, please feel free to get in touch!