PHP Class 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.
Inheritance: implements Piwik\Tracker\VisitInterface
Afficher le fichier Open project: piwik/piwik Class Usage Examples

Méthodes publiques

Свойство Type Description
$dimensions

Protected Properties

Свойство Type Description
$goalManager GoalManager
$request Request
$requestProcessors Piwik\Tracker\RequestProcessor[]
$userSettings Piwik\Tracker\Settings
$visitProperties Piwik\Tracker\Visit\VisitProperties

Méthodes publiques

Méthode Description
__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 )

Méthodes protégées

Méthode Description
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 )

Private Methods

Méthode Description
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 )

Method Details

__construct() public méthode

public __construct ( )

generateUniqueVisitorId() public static méthode

public static generateUniqueVisitorId ( ) : string
Résultat string returns random 16 chars hex string

getAllVisitDimensions() protected méthode

protected getAllVisitDimensions ( )

getSettingsObject() protected méthode

Gets the UserSettings object
protected getSettingsObject ( ) : Piwik\Tracker\Settings
Résultat Piwik\Tracker\Settings

getTimeSpentReferrerAction() protected méthode

protected getTimeSpentReferrerAction ( ) : integer
Résultat integer Time in seconds

getVisitorIdcookie() protected méthode

Returns visitor cookie
protected getVisitorIdcookie ( ) : string
Résultat string binary

getVisitorIp() protected méthode

Returns the visitor's IP address
protected getVisitorIp ( ) : string
Résultat string

handle() public méthode

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() protected méthode

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

handleNewVisit() protected méthode

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

insertNewVisit() protected méthode

protected insertNewVisit ( $visit )

isHostKnownAliasHost() public static méthode

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

setRequest() public méthode

public setRequest ( Request $request )
$request Request

updateExistingVisit() protected méthode

protected updateExistingVisit ( $valuesToUpdate )
$valuesToUpdate

Property Details

$dimensions public_oe static_oe property

public static $dimensions

$goalManager protected_oe property

protected GoalManager,Piwik\Tracker $goalManager
Résultat GoalManager

$request protected_oe property

protected Request,Piwik\Tracker $request
Résultat Request

$requestProcessors protected_oe property

protected RequestProcessor[],Piwik\Tracker $requestProcessors
Résultat Piwik\Tracker\RequestProcessor[]

$userSettings protected_oe property

protected Settings,Piwik\Tracker $userSettings
Résultat Piwik\Tracker\Settings

$visitProperties protected_oe property

protected VisitProperties,Piwik\Tracker\Visit $visitProperties
Résultat Piwik\Tracker\Visit\VisitProperties