Function API
WP Statistics supports several functions for other plugins and theme authors in order to retrieve statistics on sites. All of the external functions can be found here:
wp-statistics\includes\functions\functions.php
Function |
Description |
Get the number of users online | |
wp_statistics_visitor(time) |
Get the number of visitors |
wp_statistics_visit(time) | Get the number of views (hits) |
wp_statistics_pages(time,uri,id) |
Get the page views for a given page |
wp_statistics_uri_to_id(uri) |
Get the page ID of a given uri |
wp_statistics_get_top_pages() |
Get all pages sorted by number of hits (high to low) |
wp_statistics_get_uri() |
Get the current page’s uri |
wp_statistics_searchengine(provider, time) |
Get the number of search engine referrals |
wp_statistics_ua_list() |
Retrieve a list of all visitors’ user agents |
wp_statistics_useragent(agent) | Retrieve the number of views of users with a specific user agent |
wp_statistics_platform_list() | Retrieve a list of all visitors’ Operating Systems |
wp_statistics_platform(platform) | Retrieve the number of views of users with a specific Operating System |
wp_statistics_agent_version_list(agent) |
Retrieve a list of all visitors agent versions |
wp_statistics_agent_version(agent, version) | Retrieve the number of views of users with a specific agent version |
wp_statistics_searchengine_list(all) |
Retrieve a list of search engines, by default this only returns search engines that are active, setting all to TRUE will return ALL search engines |
wp_statistics_searchword_query (search_engine) |
Returns the SQL query portion to find all search word queries for a given search engine |
wp_statistics_searchengine_query (search_engine) |
Returns the SQL query portion to find all search engine results for a given search engine |
wp_statistics_searchengine_regex (search_engine’) |
Returns the regex to determine if a Referral URL is from a search engine |
wp_statistics_countposts() |
Total number of posts on your site |
wp_statistics_countpages() |
Total number of pages on your site |
wp_statistics_countcomment() |
Total number of comments on your site |
wp_statistics_countspam() |
Total number of spams items on your site |
wp_statistics_countusers() |
Total number of users on your site |
wp_statistics_lastpostdate() |
Last post date |
wp_statistics_average_post() |
Average number of posts |
wp_statistics_average_comment() |
Average number of comments |
wp_statistics_average_registeruser() |
Average number of users |
Where:
Item |
Description |
time | It’s the time frame (periods of time) for the statistics. This value uses the strtotime() PHP function (http://php.net/manual/en/datetime.formats.php) format, some acceptable values include:
today yesterday week month year total “-x” (i.e., “-10” for the past 10 days) Please refer to the PHP manual link above for a complete description |
provider | The search provider to get stats on (bing/duckduckgo/google/yahoo/yandex). |
URI | The URI of the page you want to get statistics for. This should only be the portion of the URI after your WordPress base directory. So if the full URL of the page you want is:http://example.com/wordpress/index.php?p=5then, the URI field should be: /index.php?p=5 |
id | The post or page id you want to get statistics for. |