This documentation page refers to Analytics Insights for WP plugin.
For other FAQ, tutorials, and helpful resources see the documentation index.
Individual analytics reports for pages and posts are generated using the webpage URI or the permalink. You can access these reports either from the backend or the frontend of your site. In the admin area, the reports are available, by default, on All Posts and All Pages screens. If enabled, individual page reports can be accessed on the frontend from your Admin toolbar.
How to debug and fix empty reports for posts and pages
Empty reports for pages, posts and webpages can have multiple causes. The most common one is a webpage with no hits. In such a case the reports are empty because there is no data to be displayed.
If all your individual analytics reports are empty, follow these steps:
I. Choose a first page for debugging
1. In your Administration area go to Pages -> All Pages.
2. Choose a page.
3. Copy the entire permalink (e.g. https://deconf.com/google-analytics-dashboard-for-wp-5-0-release-notes/), you’ll need it for step 6.
4. Select View Post from the Admin bar.
5. From your browser’s navigation bar copy the page URL (e.g. https://deconf.com/google-analytics-dashboard-for-wp-5-0-release-notes/).
6. Remove the protocol and the domain name to obtain the page URI from the links copied at step 3 and step 5.
The URI is the portion of a page’s URL following the domain name; for example, the URI portion of https://deconf.com/google-analytics-dashboard-for-wp-5-0-release-notes/ is /google-analytics-dashboard-for-wp-5-0-release-notes/.
II. Compare the page URIs
1. Go to analytics.google.com.
2. Choose the right Account and Property.
3. Go to Reports -> Engagement -> Pages and screens.
4. Look for the page with a URI similar to the page you’ve chosen.
If there are differences between the URIs, you’ll have to repeat steps from I and II until you can determine the exact portion of URI that differs. For example, while your page URI is /google-analytics-dashboard-for-wp-5-0-release-notes/, it can be reported in Google Analytics as /google-analytics-dashboard-for-wp-5-0-release-notes/index.php or /subdirectory/google-analytics-dashboard-for-wp-5-0-release-notes/.
III. Adjust the page URI using filters
Since you’re not going to make changes to your Google Analytics account, this will affect all your collected data. Meaning that changes will apply to previously collected data too.
Assuming that page URI is /test/google-analytics-dashboard-for-wp-5-0-release-notes/ and the URI reported in Google Analytics is /google-analytics-dashboard-for-wp-5-0-release-notes/, we’ll need to remove /test part to match the URI reported in Google Analytics. For this, we will use two filters to fix both the frontend and backend reports:
add_filter( 'aiwp_backenditem_uri', 'aiwp_uri_correction', 10, 1 ); add_filter( 'aiwp_frontenditem_uri', 'aiwp_uri_correction', 10, 1 ); function aiwp_uri_correction( $uri ){ return str_replace( '/test', '', $uri ); }
Instead, if the page URI is /google-analytics-dashboard-for-wp-5-0-release-notes/ and the URI reported in Google Analytics is /test/google-analytics-dashboard-for-wp-5-0-release-notes/, we’ll need to add /test to match the URI reported in Google Analytics:
add_filter( 'aiwp_backenditem_uri', 'aiwp_uri_correction', 10, 1 ); add_filter( 'aiwp_frontenditem_uri', 'aiwp_uri_correction', 10, 1 ); function aiwp_uri_correction( $uri ){ return '/test' . $uri; }
As you’ve probably noticed there are two filters, allowing you to adjust URIs independently. The aiwp_backenditem_uri filter will handle the permalinks which are used to display reports for posts and pages. The aiwp_frontenditem_uri will handle the page URIs which are used to display the individual reports for frontend webpages.