PHP Class Piwik\Tracker\GoalManager

Afficher le fichier Open project: piwik/piwik Class Usage Examples

Méthodes publiques

Méthode Description
detectGoalId ( $idSite, Request $request )
detectGoalMatch ( array $goal, Action $action ) : if Detects if an Action matches a given goal. If it does, the URL that triggered the goal is returned. Otherwise null is returned.
detectGoalsMatchingUrl ( integer $idSite, Action $action ) : array[] Look at the URL or Page Title and sees if it matches any existing Goal definition
detectIsThereExistingCartInVisit ( $visitInformation )
getGoalColumn ( $column )
getGoalDefinition ( $idSite, $idGoal )
getGoalDefinitions ( $idSite )
getGoalIds ( $idSite )
recordGoals ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request ) Records one or several goals matched in this request.

Méthodes protégées

Méthode Description
getItemRowCast ( array $row ) : array Casts the item array so that array comparisons work nicely
getItemRowEnriched ( $goal, $item )
getRevenue ( integer | float $revenue ) : integer | float Returns rounded decimal revenue, or if revenue is integer, then returns as is.
insertEcommerceItems ( array $goal, array $itemsToInsert ) : void Inserts in the cart in the DB the new items that were not previously in the cart
insertNewConversion ( array $conversion, array $visitInformation, Request $request ) : boolean Helper function used by other record* methods which will INSERT or UPDATE the conversion in the DB
isGoalPatternMatchingUrl ( $goal, $pattern_type, $url ) : boolean
isUrlMatchingGoal ( $goal, $pattern_type, $url ) : boolean
recordEcommerceGoal ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request, array $conversion, Action $action ) Records an Ecommerce conversion in the DB. Deals with Items found in the request.
recordEcommerceItems ( array $goal, array $items ) : integer Loads the Ecommerce items from the request and records them in the DB
recordStandardGoals ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request, $goal, Action $action ) Records a standard non-Ecommerce goal in the DB (URL/Title matching), linking the conversion to the action that triggered it
updateEcommerceItems ( array $goal, array $itemsToUpdate ) : void Updates the cart items in the DB that have been modified since the last cart update

Private Methods

Méthode Description
getCleanedEcommerceItems ( array $items ) : array Reads items from the request, then looks up the names from the lookup table and returns a clean array of items ready for the database.
getEcommerceItemsFromRequest ( Request $request ) : array | boolean Returns Items read from the request string
getGoalFromVisitor ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request, $action )
getModel ( )
triggerHookOnDimensions ( Request $request, Piwik\Plugin\Dimension\ConversionDimension[] $dimensions, string $hook, Piwik\Tracker\Visitor $visitor, Action | null $action, array | null $valuesToUpdate ) : array | null

Method Details

detectGoalId() public méthode

public detectGoalId ( $idSite, Request $request )
$request Request

detectGoalMatch() public méthode

Detects if an Action matches a given goal. If it does, the URL that triggered the goal is returned. Otherwise null is returned.
public detectGoalMatch ( array $goal, Action $action ) : if
$goal array
$action Action
Résultat if a goal is matched, a string of the Action URL is returned, or if no goal was matched it returns null

detectGoalsMatchingUrl() public méthode

Look at the URL or Page Title and sees if it matches any existing Goal definition
public detectGoalsMatchingUrl ( integer $idSite, Action $action ) : array[]
$idSite integer
$action Action
Résultat array[] Goals matched

detectIsThereExistingCartInVisit() public méthode

public detectIsThereExistingCartInVisit ( $visitInformation )

getGoalColumn() public méthode

public getGoalColumn ( $column )

getGoalDefinition() public static méthode

public static getGoalDefinition ( $idSite, $idGoal )

getGoalDefinitions() public static méthode

public static getGoalDefinitions ( $idSite )

getGoalIds() public static méthode

public static getGoalIds ( $idSite )

getItemRowCast() protected méthode

Casts the item array so that array comparisons work nicely
protected getItemRowCast ( array $row ) : array
$row array
Résultat array

getItemRowEnriched() protected méthode

protected getItemRowEnriched ( $goal, $item )

getRevenue() protected méthode

Returns rounded decimal revenue, or if revenue is integer, then returns as is.
protected getRevenue ( integer | float $revenue ) : integer | float
$revenue integer | float
Résultat integer | float

insertEcommerceItems() protected méthode

Inserts in the cart in the DB the new items that were not previously in the cart
protected insertEcommerceItems ( array $goal, array $itemsToInsert ) : void
$goal array
$itemsToInsert array
Résultat void

insertNewConversion() protected méthode

Helper function used by other record* methods which will INSERT or UPDATE the conversion in the DB
protected insertNewConversion ( array $conversion, array $visitInformation, Request $request ) : boolean
$conversion array
$visitInformation array
$request Request
Résultat boolean

isGoalPatternMatchingUrl() protected méthode

protected isGoalPatternMatchingUrl ( $goal, $pattern_type, $url ) : boolean
$goal
$pattern_type
$url
Résultat boolean

isUrlMatchingGoal() protected méthode

protected isUrlMatchingGoal ( $goal, $pattern_type, $url ) : boolean
$goal
$pattern_type
$url
Résultat boolean

recordEcommerceGoal() protected méthode

Will deal with 2 types of conversions: Ecommerce Order and Ecommerce Cart update (Add to cart, Update Cart etc).
protected recordEcommerceGoal ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request, array $conversion, Action $action )
$visitProperties Piwik\Tracker\Visit\VisitProperties
$request Request
$conversion array
$action Action

recordEcommerceItems() protected méthode

Loads the Ecommerce items from the request and records them in the DB
protected recordEcommerceItems ( array $goal, array $items ) : integer
$goal array
$items array
Résultat integer Number of items in the cart

recordGoals() public méthode

Records one or several goals matched in this request.
public recordGoals ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request )
$visitProperties Piwik\Tracker\Visit\VisitProperties
$request Request

recordStandardGoals() protected méthode

Records a standard non-Ecommerce goal in the DB (URL/Title matching), linking the conversion to the action that triggered it
protected recordStandardGoals ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request, $goal, Action $action )
$visitProperties Piwik\Tracker\Visit\VisitProperties
$request Request
$goal
$action Action

updateEcommerceItems() protected méthode

Updates the cart items in the DB that have been modified since the last cart update
protected updateEcommerceItems ( array $goal, array $itemsToUpdate ) : void
$goal array
$itemsToUpdate array
Résultat void