Title: Clear cache? Pull most recent posts from Google Analytics?
Last modified: March 5, 2019

---

# Clear cache? Pull most recent posts from Google Analytics?

 *  Resolved [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/)
 * Hi,
 * Is there a way to reset Toplytics to force it to pull most recent results for
   last week? Is there a cache in play?
 * How often does it check Google Analytics for new posts?
 * Thanks,
    Dean

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11278971)
 * The reason I am asking is some of our URLs were messed up in Google Analytics(
   GA). But the actual real site URLs continued to work. But if you clicked on the
   GA versions of the URLs they go to 404 page. I assume Toplytics tests the GA 
   URLs and if it is a 404 it does not include it?
 * Since discovering the issue, I have created an htaccess redirect for those URLs
   to their correct URLs on the website. When Toplytics now tests those URLs it 
   should see them as working. Does that mean it will include them in its results?
 * Thanks,
    Dean
 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11279037)
 * Finally, can I set Toplytics to pull back results from a single category?
 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11280260)
 * Hi Dean,
 * Can you please get everything tested with this version of Toplytics?
 * [http://dl.presslabs.net/toplytics-v4.0.0.zip](http://dl.presslabs.net/toplytics-v4.0.0.zip)
 * It is still in beta testing and regarding your points I can tell you the following:
 * Caching – in this new version you’ll have the possibility to fetch again the 
   data from GA. It is getting automatically refreshed every hour.
 * Messed up URL’s: can you please give us a more specific example of a wrong URL
   and a correct one? At this moment it’s unclear for me how this happened in GA.
   Were these links wrongly sent from the site?
 * As for limiting the posts to only a certain category: this is not yet implemented,
   but could be a new feature that we might add in the future.
 * Please let us know how it goes with version 4 of the plugin.
 * Thanks and best regards,
    Pedro/Presslabs Support team
 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282389)
 * Hi,
 * Thank you for the clarifying questions. My first question after looking at a 
   test page of top 25 results from timeframe “today” is that I do not see any of
   our URLs from our custom post type “special_report”. In Google Analytics (GA)
   we have several “special_report” URLs in the top 5. Does your plugin only check
   posts in the main Posts sections?
 * What is the code I use to add my custom post type to Toplytics results?
 * Thanks,
    Dean
 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282512)
 * Hi Dean,
 * If you’ll be using v 4.0 which I shared in my previous reply, then you’ll have
   to go to Settings -> Toplytics -> Settings and add your custom post type in the“
   Allowed post types” list (by default only posts are added in the list). If you
   add this to your domain, you’ll get the direct link to the Toplytics settings:
 * /wp-admin/options-general.php?page=toplytics&tab=settings
 * Let us know if you have any additional questions.
 * Best regards,
    Pedro/Presslabs Support team
 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282523)
 * Hi,
 * 1. Since I wrote you I tried the code from this post:
    [https://wordpress.org/support/topic/display-custom-post-type-2/](https://wordpress.org/support/topic/display-custom-post-type-2/)
 * Added functions.php to try and force only ‘special_reports’ to show up:
 *     ```
       add_filter( 'toplytics_allowed_post_types', 'toplytics_add_allowed_post_types' );
       function toplytics_add_allowed_post_types( $allowed_post_types ) {
           $allowed_post_types = ['special_report'];
           return $allowed_post_types;
       }
       ```
   
 * If this is correct, how do I include ‘post’ as well? Like this:
 *     ```
       add_filter( 'toplytics_allowed_post_types', 'toplytics_add_allowed_post_types' );
       function toplytics_add_allowed_post_types( $allowed_post_types ) {
           $allowed_post_types = ['special_report', 'post'];
           return $allowed_post_types;
       }
       ```
   
 * 2. And the weird URLs in GA came from a problem with a trailing slash after .
   php, like this
    mydomain.com/special_report/mypost.php/
 * Which in GA shows up as this:
    mydomain.com/special_report/mypost.php/index.php
 * Does your plugin compare the URLs in GA to the permalink URLs in the WP database?
 * Thanks,
    Dean
 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282534)
 * Hi Pedro,
 * Apologies, emailed you the same time you emailed me. Testing your plugin now.
 * Thanks,
    Dean
 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282573)
 * Hi again Dean,
 * Just to reply on your previous reply:
 * 1. Yes, that code should work on the previous plugin version!
 * 2. Yes, there is a matching done between the links from GA and what’s present
   in WordPress (and consequently the slug stored in the DB)
 * Looking forward to getting your confirmation for the new plugin version functioning!
 * Best regards,
    Pedro/Presslabs Support Team
 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282636)
 * Hi Pedro,
 * Installed the v4.0 plugin and got this error:
    Plugin could not be activated 
   because it triggered a fatal error.
 * Parse error: syntax error, unexpected ‘?’ in /wp-content/plugins/toplytics/components/
   Frontend.php on line 240
 * Thanks,
    Dean
 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282683)
 * Hi Dean,
 * This means that your site is still running on a very old version of php. This
   plugin is only compatible with PHP 7.0 and above. You should contact your host
   and request an upgrade of the PHP version (please be aware that outdated plugins
   or themes might break because of this).
 * If this is not an option, then you can continue to use v3.2 of the plugin which
   is still compatible with php 5.6 for example.
 * Best regards,
    Pedro/Presslabs Support Team
 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11282872)
 * Hi Pedro,
 * Thank you, we are upgrading to php 7.2 this weekend. I’ll follow up with v4.0
   test results then.
 * Appreciate the help,
    Dean
 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11299152)
 * Hi Dean,
 * Just wanted to follow-up on this and ask if you managed to do the upgrade to 
   php 7.2 and test v4.0 of our plugin.
 * Thanks and best regards,
    Pedro/Presslabs Support Team
 *  Thread Starter [frankin-grep](https://wordpress.org/support/users/boulderpoet/)
 * (@boulderpoet)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11337212)
 * Hi Pedro,
 * Turns out our problem was with bad URLs in Google Analytics. Once we fixed those,
   then the correct URLs bubbled to the top and started showing correctly as top
   posts in your plugin.
 * We just finished our upgrade to php 7.2, but need to hold off a bit on testing
   your plugin in our live environment. I’ll ping you back once I can test in our
   dev environment. Thanks again, Dean
 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11337866)
 * Hi Dean,
 * Thanks for your confirmation! I’ll then mark this thread as resolved and please
   get back here or start another thread for testing the new version of the plugin.
 * Best regards,
    Pedro/Presslabs Support Team.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Clear cache? Pull most recent posts from Google Analytics?’ is closed
to new replies.

 * ![](https://ps.w.org/toplytics/assets/icon-128x128.png?rev=1610348)
 * [Toplytics](https://wordpress.org/plugins/toplytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/toplytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/toplytics/)
 * [Active Topics](https://wordpress.org/support/plugin/toplytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/toplytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/toplytics/reviews/)

 * 14 replies
 * 2 participants
 * Last reply from: [Presslabs](https://wordpress.org/support/users/presslabs/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/clear-cache-pull-most-recent-posts-from-google-analytics/#post-11337866)
 * Status: resolved