CODE
toplytics

Toplytics

Toplytics is a WordPress plugin which displays the most visited posts according to Google Analytics data.

It requires Google Analytics code to be installed on the site and also access rights in the Google admin.

Install Toplytics Read the documentation

lightbulb

The idea

There was a need to easily display the most visited content. WordPress publishers with consistent traffic, but with rookie developers, can now relieve database writes by using the data already collected by Google Analytics. The site is spared from an unnecessary load and code bloat using a clean API-driven solution.

gears

Features

box

Custom templates

You can then customize your template. The plugin will first search for the file toplytics-template.php in the active theme folder, and if that’s not found, it will search for it in the plugin folder. The custom template from the theme folder has priority over the one in the plugin folder.

wordpress

Shortcode available

The shortcode can be used within post/pages and in other widgets from the sidebar. For any parameter that is not used, the default value will be used.

agenda

Optimized API requests

The data from GA is refreshed every hour. During this interval, the information is safely stored using transients and options.

safe

Cache-safe

For consistency and compatibility with various caching mechanisms, a JSON file is generated and displayable across the site.

Feel free to use and contribute

Contributions in the form of issues, bug reports, feature proposals or good old pull requests in the project repo are all equally welcome!