The How To Blog
Image default
Content Marketing Digital Marketing Marketing

How to Track User Activity in WordPress and Google Analytics

Do you want to track the activity of your logged in users in Google Analytics and WordPress? If you require people to register on your website, then you can set up WordPress user activity tracking to see more about how those visitors interact with it.

By enabling individual user ID tracking in Google Analytics, you can accurately track your logged in users across multiple devices.

In this article, we’ll take a look at how to set up WordPress user activity tracking in Google Analytics.

Can Google Analytics Track Individual Users?

If you run a community-powered WordPress site that you want your users to register an account on, such as an eCommerce site, membership site, or forum site, Google Analytics can track your individual users.

So, Google Analytics can track them, but why should you use UserID tracking?

Better Conversion Tracking

Enabling UserID tracking on your site provides you with the awesome benefit of being able to track users across devices, and for longer periods of time.

For example, say someone arrives at your site by clicking on a social media campaign from their mobile device. They leave your site without converting. Then, they come back via desktop by typing in your URL to complete the conversion.

Google Analytics will see the above example as 2 separate visitors, the second of which completed a conversion via Direct traffic. If you have UserID tracking set up, though, you can see that someone clicked on your social media campaign, then came back via the Direct channel to complete the conversion.

Here’s a look at what each User Report looks like in Google Analytics:

Google Analytics User Report

Not only will you be able to track the engagement data of each unique user, but you can discover what devices they used and track multiple sessions over an extended period of time.

Track Specific Users for Support or Marketing

Say a specific user contacts you needing support. You can find the user in Google Analytics to see what pages on your site he or she has visited, whether he’s on desktop or mobile, and more to help inform you about his needs or his problem.

You can also use these reports for marketing purposes. Say you have a page about upgrading to the next license level. With Google Analytics UserID tracking plus the MonsterInsights User ID custom dimension, you can look at that specific page in Google Analytics and see which of your users (by User ID) have viewed it. You could use that list to create an email list to target those who might be interested in upgrading.

How Does User ID Tracking Work?

When you enable UserID tracking, instead of a Client ID, Google Analytics will start using the WordPress user ID to identify registered users.

The Client ID represents the unique device from which a user engaged with your content. That means if a unique user browses through your website from two different devices, it will be counted as two different users, not a single user.

User ID tracking in Google Analytics

The WordPress user ID, however, identifies a user and follows them no matter what device they’re using:

find user ID in the URL

So, by enabling WordPress user activity tracking, you can track logged-in users more accurately even if they visit your site from different devices.

Google Analytics User Report

Now, let’s dive into how to set up user ID tracking in WordPress.

How to Set Up WordPress User Activity Tracking

The easiest way to track WordPress user ID is by using MonsterInsights. It’s the best Google Analytics plugin for WordPress.

Using the plugin, you can easily set up activity tracking and other advanced features. For instance, you can track affiliate links, file downloads, set up custom dimensions, track eCommerce performance, and more.

For tracking your logged in users, MonsterInsights replaces the anonymous Client ID in Google Analytics with the WordPress User ID with just a few clicks.

Step 1: Install MonsterInsights

The first thing you’ll need to do is to install and activate MonsterInsights on your site.

monsterinsights best wordpress plugin for google analytics

Once the plugin is active on your site, the next thing you’ll need to do is properly connect Google Analytics with MonsterInsights.

The setup wizard will guide you every step of the way. And you don’t have to edit a single line of code.

Step 2: Enable User Tracking in MonsterInsights

After installing the plugin, you will have to activate User ID tracking.

To do that, go to Insights » Settings » eCommerce. 

Now scroll down to User ID Tracking and click on the option that says Enable User ID tracking.

enable-user-id-tracking

Step 3: Enable User Tracking in Google Analytics

Note: This step is for Universal Analytics users only. If you’re using GA4, you can skip to the GA4 instructions.

Now you’ll need to enable user tracking in Google Analytics and create a new UserID view.

You’ll need to log in to your Google Analytics account and select the website you’d like to enable user tracking for.

click on google analytics view

Then, click Admin.

click admin

Now click the Tracking Info link in the center column to expand the submenu, and click the User-ID link that appears below.

click User-ID in the middle column

On the next page, you’ll have to click the Off switch to On and click the Next Step button to agree to the User-ID policy.

agree to the user id policy

In step 2, you don’t need to do anything but click Next Step again.

click next step to continue

In step 3, just click the Create button to create the UserID view.

click the create button

Next, you will be taken to this screen where you will have to enter a Reporting View Name (we recommend including UserID in the name so it’s easy to remember which view has UserID tracking enabled).

enter a name

Finally, you can scroll down and click the Create View button.

click create view

You’ll see a brief success message. Then, click the Google Analytics logo at the top of the page.

If you’re using Google Analytics 4, you need to set up a custom dimension in Google Analytics. To do that, go to Configure in the slide-out menu, then Custom definitions.

Custom Definitions GA4

Now, click the Create custom dimensions button.

Create Custom Dimensions GA4

Next, fill in a Dimension name, change the Scope dropdown to User, and create a User property. The property can be whatever makes sense to you, except it CANNOT be user_id. That’s used for something else in GA4. In our example, we’re using wordpress_id. Use whatever makes sense to you.

New Custom Dimension Form

Click Save.

That’s it! You can now add your custom dimension to reports in GA4.

How to Find the User Activity Tracking Report in Google Analytics

In Universal Analytics (Google Analytics 3), follow these instructions:

analytics-logo

You can now access your new UserID view.

user id

Then, just click on Audience » User Explorer in the left menu to see your user data. You’ll see that each user is now listed by their user ID in WordPress.

user explorer overview

You can click on the User ID to see more detailed info on each user.

user id report

Wondering how to tell which WordPress user belongs to which ID? To find out, just go to your WordPress dashboard and click on Users » All Users.

Then hover your cursor over the user you want to find the ID for. You’ll see a URL appear in the bottom of your browser. In the middle of the URL, it will say “user_id=”. The number after that is the user’s ID number.

hover to see user ID

You can click the Edit link under the username to make sure. You’ll see the user ID in the web address on the edit page.

find user ID in the URL

In Google Analytics 4, finding UserID metrics is a little bit trickier, because you need to apply your custom dimension to some existing reports.

As an example, you can go to the Traffic acquisition report and click the blue plus sign at the top of the table.

Add user ID to traffic acquisition report in GA4

In the dropdown that displays, choose Custom (User-scoped) then User ID.

Add user ID to acquisition report in Google Analytics 4

How to See a Top Users Report in WordPress & Universal Analytics

If you’re using Universal Analytics and you want to be able to add User ID as a custom dimension to reports in Google Analytics, and/or if you want a Top Users by Sessions report right in your WordPress dashboard, you’ll need the MonsterInsights plugin at the Pro level or above, and the Custom Dimensions addon. Let’s go over how to get these set up.

First, you’ll need to install MonsterInsights on your site and connect it to Google Analytics.

For the full tutorial on those steps, read How to Add Google Analytics to WordPress (The RIGHT Way).

Next, you’ll want to install the Custom Dimensions addon.

To install the addon, visit the Insights » Addons page in your WordPress dashboard. Then, click Install under the MonsterInsights Custom Dimensions addon.

Install-MonsterInsights-Dimensions-Addon

Step 2: Add Custom Dimensions in MonsterInsights

Navigate to Insights » Settings from your dashboard and click on the Conversions tab.

Conversions Tab in MonsterInsights

Scroll down to the Custom Dimensions section and choose the User ID dimension from the dropdown.

User ID Custom Dimension

Don’t worry which number is in the ID column. We’ll use that in step 4.

If you’re using Google Analytics 4, you can stop here and skip to viewing your report.

If you’re using Universal Analytics, continue on with steps 3 and 4.

Step 3: Set Up Custom Dimensions in Google Analytics

Now that you’ve set up the User ID custom dimensions on your website, the next step is to set it up in Google Analytics.

To get started, you can log into Google Analytics, and select the website in which you’d like to set up custom dimension.

Choose a Google Analytics account and view

Now, click on the Admin tab in the left panel. On the Admin page in the middle column, click Custom Definitions and then Custom Dimensions.

Custom Dimensions in Google Analytics

You’ll see a table where you can click + New Custom Dimension. Click on it.

Add a new custom dimension in Universal Analytics

Now you can type in User ID in the Name field and click Create. You don’t have to change any of the other settings.

Create the User ID custom dimension in Google Analytics

On the next screen, you can just click Done.

Repeat the steps above if you want to add more custom dimensions to your website.

Step 4: Match Custom Dimension IDs

The final step is to check that the index number in Google Analytics corresponds with the Custom Dimension ID in the MonsterInsights settings.

First, check the index number for your custom dimension in Google Analytics.

Custom dimension user ID index

Next, go back to your Custom Dimensions settings in MonsterInsights. Make sure the Custom Dimension ID corresponds to the index number in Google Analytics. If not, type in the correct number and click Save Changes.

Custom dimension index in MonsterInsights

That’s it! Now you can view your custom dimensions report in your WordPress dashboard.

You can view your custom dimensions reports in the MonsterInsights dashboard by going to Insights » Reports » Dimensions.

User ID Custom Dimension Report

We hope this article helped you learn how to set up WordPress user activity tracking. If you enjoyed this article, you might also want to read the beginners’ guide to custom dimensions in Google Analytics.

And don’t forget to follow us on Twitter and Facebook for more Google Analytics tutorials.

Related posts

Copywriting Techniques for Each Type of Sales Funnel Content

DevPlus Ng

5 Ways to Stop Wasting Money on Marketing

DevPlus Ng

Best Reporting Tools for Digital Marketers in 2020: How to Choose the Best Option for Your Project

DevPlus Ng

Leave a Comment