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:
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.
The WordPress user ID, however, identifies a user and follows them no matter what device they’re using:
So, by enabling WordPress user activity tracking, you can track logged-in users more accurately even if they visit your site from different devices.
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.
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.
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.
Then, 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.
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.
In step 2, you don’t need to do anything but click Next Step again.
In step 3, just click the Create button to create the UserID view.
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).
Finally, you can scroll down and click the Create View button.
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.
Now, click the Create custom dimensions button.
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.
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:
You can now access your new UserID view.
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.
You can click on the User ID to see more detailed info on each user.
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.
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.
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.
In the dropdown that displays, choose Custom (User-scoped) then User ID.
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.
Step 2: Add Custom Dimensions in MonsterInsights
Navigate to Insights » Settings from your dashboard and click on the Conversions tab.
Scroll down to the Custom Dimensions section and choose the User ID dimension from the dropdown.
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.
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.
You’ll see a table where you can click + New Custom Dimension. Click on it.
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.
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.
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.
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.
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.
Is it beneficial to set this up even if the website is not an eCommerce site?
Absolutely! If your website requires users to log in then tracking user activities can unveil exciting insights.
Is this able to track WordPress users segmented by user role?
Hey Nick – Great question. Unfortunately it does not at this time. We’ll add this as a feature request!
What about GDPR compliance? As I know, tracking User-IDs with Google Analytics is not GDPR compliant and thus should actually not be done?
If you are required to make your site compliant with GDPR, you are correct that you may need to disable the User-ID tracking feature or avoid setting it up altogether for your website,
We built an EU Compliance addon to help website owners automate settings needed for GDPR compliance such as disabling User-ID tracking, anonymizing IP addresses, and more.
Please keep in mind you’ll need to consult with a specialist internet law attorney to determine if you are in compliance with all applicable laws for your jurisdictions and your use cases.
How do I set this up in universal analytics? The above is now out of date.
Hey Scott! Thanks for your comment. You should be able to find directions for both UA and GA4 in the article – the first 2 steps are the same, then step 3 has instructions for both UA and GA4. If it’s still confusing, let me know!