PHP Класс Piwik\Tracker\GoalManager

Показать файл Открыть проект Примеры использования класса

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

Метод Описание
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.

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

Метод Описание
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

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

Метод Описание
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

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

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

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

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

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
Результат if a goal is matched, a string of the Action URL is returned, or if no goal was matched it returns null

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

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
Результат array[] Goals matched

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

public detectIsThereExistingCartInVisit ( $visitInformation )

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

public getGoalColumn ( $column )

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

public static getGoalDefinition ( $idSite, $idGoal )

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

public static getGoalDefinitions ( $idSite )

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

public static getGoalIds ( $idSite )

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

Casts the item array so that array comparisons work nicely
protected getItemRowCast ( array $row ) : array
$row array
Результат array

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

protected getItemRowEnriched ( $goal, $item )

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

Returns rounded decimal revenue, or if revenue is integer, then returns as is.
protected getRevenue ( integer | float $revenue ) : integer | float
$revenue integer | float
Результат integer | float

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

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
Результат void

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

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
Результат boolean

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

protected isGoalPatternMatchingUrl ( $goal, $pattern_type, $url ) : boolean
$goal
$pattern_type
$url
Результат boolean

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

protected isUrlMatchingGoal ( $goal, $pattern_type, $url ) : boolean
$goal
$pattern_type
$url
Результат boolean

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

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() защищенный Метод

Loads the Ecommerce items from the request and records them in the DB
protected recordEcommerceItems ( array $goal, array $items ) : integer
$goal array
$items array
Результат integer Number of items in the cart

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

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() защищенный Метод

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() защищенный Метод

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
Результат void