piwik/core/Tracker/VisitExcluded.php
/**
     * Test if the current visitor is excluded from the statistics.
     *
     * Plugins can for example exclude visitors based on the
     * - IP
     * - If a given cookie is found
     *
     * @return bool True if the visit must not be saved, false otherwise
     */
Test if the current visitor is excluded from the statistics.
Plugins can for example exclude visitors based on the
- IP
- If a given cookie is found

@return bool True if the visit must not be saved, false otherwise
Test if the current visitor is excluded from the statistics . Plugins can for example exclude visitors based on the - IP - If a given cookie is found @return bool True if the visit must not be saved false otherwise
public function isExcluded()
    {
        $excluded = false;
        if ($this->isNonHumanBot()) {
            Common::printDebug('Search bot detected, visit excluded');
            $excluded = true;
        }
        if (!$excluded) {
            $toRecord = $this->request->getParam($parameterForceRecord = 'rec');
            if (!$toRecord) {
                Common::printDebug(@$_SERVER['REQUEST_METHOD'] . ' parameter ' . $parameterForceRecord . ' not found in URL, request excluded');
                $excluded = true;
                Common::printDebug("'$parameterForceRecord' parameter not found.");
            }
        }
        Piwik::postEvent('Tracker.isExcludedVisit', array(&$excluded));
        if (!$excluded) {
            $excluded = $this->isIgnoreCookieFound();
            if ($excluded) {
                Common::printDebug("Ignore cookie found.");
            }
        }
        if (!$excluded) {
            $excluded = $this->isVisitorIpExcluded();
            if ($excluded) {
                Common::printDebug("IP excluded.");
            }
        }
        if (!$excluded) {
            $excluded = $this->isUserAgentExcluded();
            if ($excluded) {
                Common::printDebug("User agent excluded.");
            }
        }
        if (!$excluded) {
            $excluded = $this->isReferrerSpamExcluded();
            if ($excluded) {
                Common::printDebug("Referrer URL is blacklisted as spam.");
            }
        }
        if (!$excluded) {
            if ($this->isPrefetchDetected()) {
                $excluded = true;
                Common::printDebug("Prefetch request detected, not a real visit so we Ignore this visit/pageview");
            }
        }
        if ($excluded) {
            Common::printDebug("Visitor excluded.");
            return true;
        }
        return false;
    }
public function isExcluded ( ) { $ excluded = false ; if ( $ this -> isNonHumanBot ( ) ) { Common :: printDebug ( 'Search bot detected, visit excluded' ) ; $ excluded = true ; } if ( ! $ excluded ) { $ toRecord = $ this -> request -> getParam ( $ parameterForceRecord = 'rec' ) ; if ( ! $ toRecord ) { Common :: printDebug ( @ $ _SERVER [ 'REQUEST_METHOD' ] . ' parameter ' . $ parameterForceRecord . ' not found in URL, request excluded' ) ; $ excluded = true ; Common :: printDebug ( " ' $ parameterForceRecord ' parameter not found. " ) ; } } Piwik :: postEvent ( 'Tracker.isExcludedVisit' , array ( & $ excluded ) ) ; if ( ! $ excluded ) { $ excluded = $ this -> isIgnoreCookieFound ( ) ; if ( $ excluded ) { Common :: printDebug ( " Ignore cookie found. " ) ; } } if ( ! $ excluded ) { $ excluded = $ this -> isVisitorIpExcluded ( ) ; if ( $ excluded ) { Common :: printDebug ( " IP excluded. " ) ; } } if ( ! $ excluded ) { $ excluded = $ this -> isUserAgentExcluded ( ) ; if ( $ excluded ) { Common :: printDebug ( " User agent excluded. " ) ; } } if ( ! $ excluded ) { $ excluded = $ this -> isReferrerSpamExcluded ( ) ; if ( $ excluded ) { Common :: printDebug ( " Referrer URL is blacklisted as spam. " ) ; } } if ( ! $ excluded ) { if ( $ this -> isPrefetchDetected ( ) ) { $ excluded = true ; Common :: printDebug ( " Prefetch request detected, not a real visit so we Ignore this visit/pageview " ) ; } } if ( $ excluded ) { Common :: printDebug ( " Visitor excluded. " ) ; return true ; } return false ; }
Test if the current visitor is excluded from the statistics.
Test if the current visitor is excluded from the statistics .
/*
         * Requests built with piwik.js will contain a rec=1 parameter. This is used as
         * an indication that the request is made by a JS enabled device. By default, Piwik
         * doesn't track non-JS visitors.
         */ /**
         * Triggered on every tracking request.
         *
         * This event can be used to tell the Tracker not to record this particular action or visit.
         *
         * @param bool &$excluded Whether the request should be excluded or not. Initialized
         *                        to `false`. Event subscribers should set it to `true` in
         *                        order to exclude the request.
         */ /*
         * Following exclude operations happen after the hook.
         * These are of higher priority and should not be overwritten by plugins.
         */ // Checking if the Piwik ignore cookie is set // Checking for excluded IPs // Check if user agent should be excluded // Check if Referrer URL is a known spam