Esempio n. 1
0
/**
 * Initiates tracking process
 *
 * @param object $query. this object is passed to this callback function of "parse_request" hooked action
 * @return void
 */
function ahc_track_visitor($query)
{
    if (ahc_should_track_visitor() && !ahc_is_login_page() && !ahc_is_search_engine_bot() && !ahc_is_wordpress_bot()) {
        $page = ahc_detect_requested_page($query);
        if (is_array($page)) {
            Globals::$page_id = $page['page_id'];
            Globals::$page_title = $page['page_title'];
            Globals::$post_type = $page['post_type'];
        } else {
            return;
        }
        $hitsCounter = new WPHitsCounter(Globals::$page_id, Globals::$page_title, Globals::$post_type);
        $hitsCounter->traceVisitorHit();
    }
}