Category: Guides

How to Track Visitor Statistics in Headless WordPress Themes Using WP Statistics

In today’s dynamic web development landscape, headless WordPress setups have gained immense popularity. By decoupling the front end and back end, developers can leverage modern technologies like React, Vue.js, and Angular to create interactive and highly responsive user experiences. However, tracking visitor statistics in such headless WordPress setups can be challenging. Fortunately, WP Statistics offers […]

Beginners Guide to WP Statistics Plugin

In this post, we want to appreciate all the information SERT Media recorded in this Youtube video. All the WP Statistics users who have just started using this plugin can follow this beginners’ step-by-step guide. So they will find out anything they can do with our available options. In the video, you will see all […]

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.3And your real IP is: 192.000.000.1You can use a final filter like this: Or if your $_SERVER: for=192.000.000.1;proto=http;host=site.comAnd your real IP is: 192.000.000.1Use this […]

How to Stop Tracking in WP Statistics with PHP code?

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

Receive page’s views number in different periods of time

You can receive the number of views 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); […]