Archives: Documentations

Requirements

WP Statistics requires a few things to work: WordPress 3.0 or above PHP 5.4 or above MySQL 5.0 or above WP Statistics might work on older versions of the above software, but then again, it might not (it does NOT function on any PHP versions before 5.3). The GeoIP support also requires a few additional […]

Installation

Installation is straight forward, you can either use WordPress’ built in installation process or manually upload the files to the WordPress plugin directory. Once installed, go to the WordPress plugin page and activate WP Statistics. You should then configure the settings found in the following sections, at a minimum, check the sections on the GeoIP, […]

Introduction

Welcome to WP Statistics! This plug-in is designed to track your visitor statistics in WordPress, completely locally without any external services. There are several key items to note about WP Statistics: No external services are required, all code and data runs locally on your system. Aggregate data is stored whenever possible, when specific data is […]

Receive the number of visits from a page in different periods of time

You can receive the number of visits from a page or post in different periods of time. It’s done with the following PHP code: $page_id = 3; // Your page ID // Get page hits $today = wp_statistics_pages(‘today’, $page_id); $yesterday = wp_statistics_pages(‘yesterday’, $page_id); $week = wp_statistics_pages(‘week’, $page_id); $month = wp_statistics_pages(‘month’, $page_id); $year = wp_statistics_pages(‘year’, $page_id); […]

How stops tracking in WP-Statistics with PHP code

Sometimes you need to enable the Anonymize IP Addresses with PHP code for GDPR, in here is an example to do that.   add_action(‘init’, function (){ global $WP_Statistics; $WP_Statistics->update_option( ‘anonymize_ips’, ‘1’ ); });  

How to Sanitize user IP?

If the IP value returned from your server has a special character, you can use:wp_statistics_sanitize_user_ipfilter in your WordPress for getting real user IP from your $_SERVER. For example: If your $_SERVER: 192.000.000.1, 192.000.000.2, 192.000.000.3 And your real IP is: 192.000.000.1 You can use a final filter like this: Or if your $_SERVER: for=192.000.000.1;proto=http;host=site.com And your […]

Main Interface

WP Statistics adds a top level menu to your admin interface in WordPress, you should see this in your main admin page (image on the left below) near the bottom of the list, clicking on it should bring up the additional items (image on the right below): Each of these options will be discussed in […]

Dashboard Widgets

WP Statistics includes a number of dashboard widgets you can add if you have read access to WP Statistics. By default, the dashboard widgets are not displayed, with the exception of the Quick Stats widget. Users can individually enable them through the “Screen Options” drop down in the WordPress dashboard. The dashboard widgets mirror the […]

Settings Page

The first thing you should do after installing WP Statistics is configure the plug-in, this is accomplished through the settings page. Simply go to Statistics -> Settings to get there. The main settings page looks like this:   At the top are nine tabs, each one will be addressed separately. General Settings The General Settings […]