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.
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.
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.
The data from GA is refreshed every hour. During this interval, the information is safely stored using transients and options.
For consistency and compatibility with various caching mechanisms, a JSON file is generated and displayable across the site.