PHP Class Piwik\Tracker\GoalManager

Exibir arquivo Open project: piwik/piwik Class Usage Examples

Public Methods

Method 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.

Protected Methods

Method 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

Method 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 method

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

detectGoalMatch() public method

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
return if a goal is matched, a string of the Action URL is returned, or if no goal was matched it returns null

detectGoalsMatchingUrl() public method

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
return array[] Goals matched

detectIsThereExistingCartInVisit() public method

public detectIsThereExistingCartInVisit ( $visitInformation )

getGoalColumn() public method

public getGoalColumn ( $column )

getGoalDefinition() public static method

public static getGoalDefinition ( $idSite, $idGoal )

getGoalDefinitions() public static method

public static getGoalDefinitions ( $idSite )

getGoalIds() public static method

public static getGoalIds ( $idSite )

getItemRowCast() protected method

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

getItemRowEnriched() protected method

protected getItemRowEnriched ( $goal, $item )

getRevenue() protected method

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

insertEcommerceItems() protected method

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
return void

insertNewConversion() protected method

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
return boolean

isGoalPatternMatchingUrl() protected method

protected isGoalPatternMatchingUrl ( $goal, $pattern_type, $url ) : boolean
$goal
$pattern_type
$url
return boolean

isUrlMatchingGoal() protected method

protected isUrlMatchingGoal ( $goal, $pattern_type, $url ) : boolean
$goal
$pattern_type
$url
return boolean

recordEcommerceGoal() protected method

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 method

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

recordGoals() public method

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 method

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 method

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
return void