If you run WordPress Multisite and is scratching your head thinking how to track traffic to the different sites, how to separate them and generate different traffic reports and allow different users access to them, here is how.
Keeping all the traffic data in one place on Google Analytics for a website makes it easier to have a wholistic view of the entire website data (All Web Site Data) as well as being able to track traffic to the individual sub-sites. There are two different types of WordPress Multisite Installations:
For the purpose of this article, we will be considering the second type, sub-directory, see examples below:
Tracking Traffic Data to Sub-Directories with Google Analytics
Here is how we do it. This is no different to tracking traffic to any sub-pages on a standard WordPress website. The pre-requisite is to ensure that the same tracking code from the main site is applied to the header of the sub-sites either via your theme or using a plugin. This article also assumes that you already track the traffic to the main site and have created the necessary property and embedded the tracking code for the site on Google Analytics.
Step by Steps How to Create a New View and Apply a Filter
Here are the steps, login to Google Analytics
- Switch over to the right Property or accounts. This is your main site www.mainsite.com
- Go to Admin (bottom right Gear icon)
- Click +Create View button, in the third column
- In the New Reporting View page for the subsite, complete the name and set reporting time zone. Don’t worry, you can come back and change this later under View Settings in the Admin page. Click Create View to complete the step.
- You will be sent back to the Admin page, click on Filters for the newly create view under the third column. From this slide out, click the red +ADD FILTER button.
- In the Add Filter to View page, this is where you limit your view to only the subsite, using the following settings: Predefined > Include only, traffic to the subdirectories, that contain then add the subdirectory /subsite1/
- Click Save to finish. You can click Verify this filter only if the view is live. This usually takes up to 48 hours times 72 hours.
- Once the View is live, you can track the traffic to the sub site using the drop down menu for your main site and choose the different sub-site you have just created from the Views section.
That is all there is.
Frequently Asked Questions
Not getting the result you were expecting, here are some frequently asked questions.
1. Filter Verification: Resource is not available. Please try again later
If you get the following pop-up error message:
Resource is not available. Please try again later. One or more of the services on which we depend is unavailable. Please try again later after the service has had a chance to recover
Chances are, you have created a new view and then created a filter following the steps above, and being eager, trying to test this filter using “Filter Verification”. This usually happens when the new view hasn’t gone live yet. Don’t worry about this and check back the next day or later.
2. Filter Verification: Sampled data is too small
In Add Filter to View or Edit Filter page, Filter Verification says the following “This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small.” see screenshot below.
This is because the new view does not contain historical data and will only track data from the point it goes live. Even when it has come online, and unless yours is a super busy site, it will take time to have good enough data to show. This does not stop the new view from tracking the sub site.
3. Google Analytics: New view has no data, not even live traffic data
Once you have created and new view and added the filter as described above, you can check if it works by visiting the Realtime > Overview page. Use a different browser or device and access the sub-site to check this. If you don’t see any live traffic data, do not fret. It usually takes up to 48 hours, some reported 72 hours before you can see any meaningful data let alone Realtime stream. So, if you cannot see any traffic being tracked under the new view for your website immediately, just be patient.