PHP Класс Piwik\Tracker\Visit

A visit is either NEW or KNOWN. - If a visit is NEW then we process the visitor information (settings, referrers, etc.) and save a new line in the log_visit table. - If a visit is KNOWN then we update the visit row in the log_visit table, updating the number of pages views, time spent, etc. Whether a visit is NEW or KNOWN we also save the action in the DB. One request to the piwik.php script is associated to one action.
Наследование: implements Piwik\Tracker\VisitInterface
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$dimensions

Защищенные свойства (Protected)

Свойство Тип Описание
$goalManager GoalManager
$request Request
$requestProcessors Piwik\Tracker\RequestProcessor[]
$userSettings Piwik\Tracker\Settings
$visitProperties Piwik\Tracker\Visit\VisitProperties

Открытые методы

Метод Описание
__construct ( )
generateUniqueVisitorId ( ) : string
handle ( ) Main algorithm to handle the visit.
isHostKnownAliasHost ( $urlHost, $idSite ) is the host any of the registered URLs for this website?
setRequest ( Request $request )

Защищенные методы

Метод Описание
getAllVisitDimensions ( )
getSettingsObject ( ) : Piwik\Tracker\Settings Gets the UserSettings object
getTimeSpentReferrerAction ( ) : integer
getVisitorIdcookie ( ) : string Returns visitor cookie
getVisitorIp ( ) : string Returns the visitor's IP address
handleExistingVisit ( $visitIsConverted ) In the case of a known visit, we have to do the following actions:
handleNewVisit ( boolean $visitIsConverted ) In the case of a new visit, we have to do the following actions:
insertNewVisit ( $visit )
updateExistingVisit ( $valuesToUpdate )

Приватные методы

Метод Описание
getExistingVisitFieldsToUpdate ( $visitIsConverted ) : array Gather fields=>values that needs to be updated for the existing visit in log_visit
getModel ( )
getTimezoneForSite ( $idSite )
getVisitStandardLength ( )
makeVisitorFacade ( )
markArchivedReportsAsInvalidIfArchiveAlreadyFinished ( )
printVisitorInformation ( )
setIdVisitorForExistingVisit ( $valuesToUpdate ) : mixed
setNewVisitorInformation ( )
toCanonicalHost ( $host )
triggerHookOnDimensions ( Piwik\Plugin\Dimension\VisitDimension[] $dimensions, string $hook, array | null $valuesToUpdate = null ) : array | null
triggerPredicateHookOnDimensions ( $dimensions, $hook )

Описание методов

__construct() публичный Метод

public __construct ( )

generateUniqueVisitorId() публичный статический Метод

public static generateUniqueVisitorId ( ) : string
Результат string returns random 16 chars hex string

getAllVisitDimensions() защищенный Метод

protected getAllVisitDimensions ( )

getSettingsObject() защищенный Метод

Gets the UserSettings object
protected getSettingsObject ( ) : Piwik\Tracker\Settings
Результат Piwik\Tracker\Settings

getTimeSpentReferrerAction() защищенный Метод

protected getTimeSpentReferrerAction ( ) : integer
Результат integer Time in seconds

getVisitorIdcookie() защищенный Метод

Returns visitor cookie
protected getVisitorIdcookie ( ) : string
Результат string binary

getVisitorIp() защищенный Метод

Returns the visitor's IP address
protected getVisitorIp ( ) : string
Результат string

handle() публичный Метод

Once we have the visitor information, we have to determine if the visit is a new or a known visit. 1) When the last action was done more than 30min ago, or if the visitor is new, then this is a new visit. 2) If the last action is less than 30min ago, then the same visit is going on. Because the visit goes on, we can get the time spent during the last action. NB: - In the case of a new visit, then the time spent during the last action of the previous visit is unknown. - In the case of a new visit but with a known visitor, we can set the 'returning visitor' flag. In all the cases we set a cookie to the visitor with the new information.
public handle ( )

handleExistingVisit() защищенный Метод

1) Insert the new action 2) Update the visit information
protected handleExistingVisit ( $visitIsConverted )
$visitIsConverted

handleNewVisit() защищенный Метод

1) Insert the new action 2) Insert the visit information
protected handleNewVisit ( boolean $visitIsConverted )
$visitIsConverted boolean

insertNewVisit() защищенный Метод

protected insertNewVisit ( $visit )

isHostKnownAliasHost() публичный статический Метод

is the host any of the registered URLs for this website?
public static isHostKnownAliasHost ( $urlHost, $idSite )

setRequest() публичный Метод

public setRequest ( Request $request )
$request Request

updateExistingVisit() защищенный Метод

protected updateExistingVisit ( $valuesToUpdate )
$valuesToUpdate

Описание свойств

$dimensions публичное статическое свойство

public static $dimensions

$goalManager защищенное свойство

protected GoalManager,Piwik\Tracker $goalManager
Результат GoalManager

$request защищенное свойство

protected Request,Piwik\Tracker $request
Результат Request

$requestProcessors защищенное свойство

protected RequestProcessor[],Piwik\Tracker $requestProcessors
Результат Piwik\Tracker\RequestProcessor[]

$userSettings защищенное свойство

protected Settings,Piwik\Tracker $userSettings
Результат Piwik\Tracker\Settings

$visitProperties защищенное свойство

protected VisitProperties,Piwik\Tracker\Visit $visitProperties
Результат Piwik\Tracker\Visit\VisitProperties