Installing Google Analytics on WordPress

Metrics are the often-overlooked part of managing a website, but knowing who is visiting the site, where they are reaching the site from and what they are clicking on when they reach the site are the keys to creating a website that is best-suited to your target audience. Google provides one of the best free analytics tools—Google Analytics—which we recommend to our clients.

Get your code from Google

To get started, you need to set up your Google Analytics account with Google. Login to Google with your user credentials, go to Admin and in the Account column click Create Account. You’ll have to add a account name and set the data-sharing controls (what data you’ll share with Google) then click Next to set up a property. The properties you create will correspond to your websites, so the name should reflect the website that you’re setting up tracking for. You need to choose time zone info then click the Show Advanced Options link. You should see a toggle for creating a Universal Analytics Property. Click that and add your website’s URL in the designated field. At this point, you can choose to create both the Google Analytics 4 and Universal Analytics properties, or you can create only the Universal Analytics property. GA4 is a newer tracking system with enhanced interactivity tracking. Once you’ve made your choice, click Next and Create and you must accept the terms of service agreement. Once you’ve done all this, you’ll get the UA code. Copy it. You’ll need it when adding the tracking code to your website.

Add the UA code to your website

Many WordPress themes include a field for entering the UA tracking code. Once the code is pasted into the field, the theme adds it to the website’s head. AIM’s websites do this automatically. But there are other ways to achieve the same result. There are several Google Analytics plugins that not only add the UA code but also add a dashboard viewport of your analytics. MonsterInsights is the most popular of these, and you can’t go wrong using it. You can also add the snippet directly through a simple coded function that adds the code to the wp_head hook. If you understand WordPress and PHP, knock yourself out. Otherwise, stick with the plugin or theme method. Once the tracking code is installed, it takes 24 hours to begin getting results. At that time, you can visit your Google account or in-dash view (if you’ve added a plugin with that feature) and discover how visitors are using your website.

Discover how we can help you. Call now: (425) 442-1558