Deconf.com

How to debug and fix empty reports for posts and pages

This documentation page refers to Google Analytics Dashboard for WP (GADWP) plugin.

For other FAQ, tutorials, and helpful resources see the GADWP 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 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, Property, and then a View.
  3. Go to Behavior -> Site Content -> All Pages.
  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 URIs from your Google Analytics account

Please note that changes made in your Google Analytics account will take effect from the moment they were made and no older data will be reprocessed to reflect the changes.

If all reported URIs have a suffix like index.php, index.html and so on follow these steps:

  1. Go to analytics.google.com.
  2. Select Admin from your sidebar.
  3. Select the right View.
  4. Go to View Settings.
  5. Check if the Default Page field is empty.
  6. If it is not empty and its value is set to the suffix in question, you should empty the Default Page field.
  7. Click on Save.
  8. If it’s empty, continue with the next steps.

If a different suffix or a prefix is present on your reported page URI follow these steps:

  1. Go to analytics.google.com.
  2. Select Admin from your sidebar.
  3. Select the right View.
  4. Go to Filters.
  5. Check if there are any filters that may add, replace, or remove parts of page URI.
  6. Disable all filters that may change the page URI.

IV. Adjust the page URI using GADWP filters

Since you’re not going to make changes on your Google Analytics account, this will affect all your collected data. Meaning that changes will apply to previous 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( 'gadwp_backenditem_uri', 'gadwp_uri_correction', 10, 1 );
add_filter( 'gadwp_frontenditem_uri', 'gadwp_uri_correction', 10, 1 );

function gadwp_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( 'gadwp_backenditem_uri', 'gadwp_uri_correction', 10, 1 );
add_filter( 'gadwp_frontenditem_uri', 'gadwp_uri_correction', 10, 1 );

function gadwp_uri_correction( $uri ){
   return '/test' . $uri;
}

As you’ve probably noticed there are two filters, allowing you to adjust URIs independently. The gadwp_backenditem_uri filter will handle the permalinks which are used to display reports for posts and pages. The gadwp_frontenditem_uri will handle the page URIs which are used to display the individual reports for frontend webpages.