PHP 클래스 Piwik\Plugins\Goals\API

If you are tracking Ecommerce orders and products on your site, the functions "getItemsSku", "getItemsName" and "getItemsCategory" will return the list of products purchased on your site, either grouped by Product SKU, Product Name or Product Category. For each name, SKU or category, the following metrics are returned: Total revenue, Total quantity, average price, average quantity, number of orders (or abandoned carts) containing this product, number of visits on the Product page, Conversion rate. By default, these functions return the 'Products purchased'. These functions also accept an optional parameter &abandonedCarts=1. If the parameter is set, it will instead return the metrics for products that were left in an abandoned cart therefore not purchased. The API also lets you request overall Goal metrics via the method "get": Conversions, Visits with at least one conversion, Conversion rate and Revenue. If you wish to request specific metrics about Ecommerce goals, you can set the parameter &idGoal=ecommerceAbandonedCart to get metrics about abandoned carts (including Lost revenue, and number of items left in the cart) or &idGoal=ecommerceOrder to get metrics about Ecommerce orders (number of orders, visits with an order, subtotal, tax, shipping, discount, revenue, items ordered) See also the documentation about Tracking Goals in Piwik.
상속: extends Piwik\Plugin\API
파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

공개 메소드들

메소드 설명
addGoal ( integer $idSite, string $name, string $matchAttribute, string $pattern, string $patternType, boolean $caseSensitive = false, boolean | float $revenue = false, boolean $allowMultipleConversionsPerVisit = false, string $description = '' ) : integer Creates a Goal for a given website.
deleteGoal ( integer $idSite, integer $idGoal ) : void Soft deletes a given Goal.
get ( integer $idSite, string $period, string $date, boolean $segment = false, boolean | integer $idGoal = false, array $columns = [] ) : DataTable Returns Goals data.
getConversionRate ( $idSite, $period, $date, $segment = false, $idGoal = false )
getConversions ( $idSite, $period, $date, $segment = false, $idGoal = false )
getDaysToConversion ( integer $idSite, string $period, string $date, string | boolean $segment = false, integer | boolean $idGoal = false ) : false | DataTable Gets a DataTable that maps ranges of days to the number of conversions that occurred within those ranges, for the specified site, date range, segment and goal.
getGoal ( integer $idSite, integer $idGoal ) : array Return a single goal.
getGoals ( string | array $idSite ) : array Returns all Goals for a given website, or list of websites
getItemsCategory ( $idSite, $period, $date, $abandonedCarts = false, $segment = false )
getItemsName ( $idSite, $period, $date, $abandonedCarts = false, $segment = false )
getItemsSku ( $idSite, $period, $date, $abandonedCarts = false, $segment = false )
getMetrics ( $idSite, $period, $date, $segment = false, $idGoal = false, $columns = [] ) Similar to {@link get()} but does not return any metrics for new and returning visitors. It won't apply any segment by default. This method is deprecated from the API as it is only there to make the implementation of the actual {@link get()} method easy.
getNbVisitsConverted ( $idSite, $period, $date, $segment = false, $idGoal = false )
getRevenue ( $idSite, $period, $date, $segment = false, $idGoal = false )
getVisitsUntilConversion ( integer $idSite, string $period, string $date, string | boolean $segment = false, integer | boolean $idGoal = false ) : boolean | DataTable Gets a DataTable that maps ranges of visit counts to the number of conversions that occurred on those visits for the specified site, date range, segment and goal.
updateGoal ( integer $idSite, integer $idGoal, $name, $matchAttribute, string $pattern, string $patternType, boolean $caseSensitive = false, boolean | float $revenue = false, boolean $allowMultipleConversionsPerVisit = false, string $description = '' ) : void Updates a Goal description.

보호된 메소드들

메소드 설명
appendSegment ( $segment, $segmentToAppend )
convertSpecialGoalIds ( string | integer $idGoal ) : integer Helper function that checks for special string goal IDs and converts them to their integer equivalents.
enrichItemsDataTableWithItemsViewMetrics ( $dataTable, $idSite, $period, $date, $segment, $idSubtable )
enrichItemsTableWithViewMetrics ( $dataTable, $recordName, $idSite, $period, $date, $segment ) Enhances the dataTable with Items attributes found in the Custom Variables report.
getGoalSpecificDataTable ( string $recordName, integer | string $idSite, string $period, string $date, string $segment, integer | boolean $idGoal ) : false | DataTable Utility method that retrieve an archived DataTable for a specific site, date range, segment and goal. If not goal is specified, this method will retrieve and sum the data for every goal.
getItems ( $recordName, $idSite, $period, $date, $abandonedCarts, $segment ) Returns a datatable of Items SKU/name or categories and their metrics If $abandonedCarts set to 1, will return items abandoned in carts. If set to 0, will return items ordered
getNumeric ( $idSite, $period, $date, $segment, $toFetch )
renameNotDefinedRow ( $dataTable, $notDefinedStringPretty )

비공개 메소드들

메소드 설명
checkDescription ( $description )
checkName ( $name )
checkPattern ( $pattern )
checkPatternIsValid ( $patternType, $pattern, $matchAttribute )
formatGoal ( $goal )
getCacheId ( $idSite )
getGoalsInfoStaticCache ( )
getModel ( )

메소드 상세

addGoal() 공개 메소드

Creates a Goal for a given website.
public addGoal ( integer $idSite, string $name, string $matchAttribute, string $pattern, string $patternType, boolean $caseSensitive = false, boolean | float $revenue = false, boolean $allowMultipleConversionsPerVisit = false, string $description = '' ) : integer
$idSite integer
$name string
$matchAttribute string 'url', 'title', 'file', 'external_website', 'manually', 'event_action', 'event_category' or 'event_name'
$pattern string eg. purchase-confirmation.htm
$patternType string 'regex', 'contains', 'exact'
$caseSensitive boolean
$revenue boolean | float If set, default revenue to assign to conversions
$allowMultipleConversionsPerVisit boolean By default, multiple conversions in the same visit will only record the first conversion. If set to true, multiple conversions will all be recorded within a visit (useful for Ecommerce goals)
$description string
리턴 integer ID of the new goal

appendSegment() 보호된 메소드

protected appendSegment ( $segment, $segmentToAppend )

convertSpecialGoalIds() 보호된 정적인 메소드

Checks for the following values: Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART
protected static convertSpecialGoalIds ( string | integer $idGoal ) : integer
$idGoal string | integer The goal id as an integer or a special string.
리턴 integer The numeric goal id.

deleteGoal() 공개 메소드

Stats data in the archives will still be recorded, but not displayed.
public deleteGoal ( integer $idSite, integer $idGoal ) : void
$idSite integer
$idGoal integer
리턴 void

enrichItemsDataTableWithItemsViewMetrics() 보호된 메소드

protected enrichItemsDataTableWithItemsViewMetrics ( $dataTable, $idSite, $period, $date, $segment, $idSubtable )

enrichItemsTableWithViewMetrics() 보호된 메소드

Enhances the dataTable with Items attributes found in the Custom Variables report.
protected enrichItemsTableWithViewMetrics ( $dataTable, $recordName, $idSite, $period, $date, $segment )
$dataTable
$recordName
$idSite
$period
$date
$segment

get() 공개 메소드

Returns Goals data.
public get ( integer $idSite, string $period, string $date, boolean $segment = false, boolean | integer $idGoal = false, array $columns = [] ) : DataTable
$idSite integer
$period string
$date string
$segment boolean
$idGoal boolean | integer
$columns array Array of metrics to fetch: nb_conversions, conversion_rate, revenue
리턴 Piwik\DataTable

getConversionRate() 공개 메소드

public getConversionRate ( $idSite, $period, $date, $segment = false, $idGoal = false )

getConversions() 공개 메소드

public getConversions ( $idSite, $period, $date, $segment = false, $idGoal = false )

getDaysToConversion() 공개 메소드

Gets a DataTable that maps ranges of days to the number of conversions that occurred within those ranges, for the specified site, date range, segment and goal.
public getDaysToConversion ( integer $idSite, string $period, string $date, string | boolean $segment = false, integer | boolean $idGoal = false ) : false | DataTable
$idSite integer The site to select data from.
$period string The period type.
$date string The date type.
$segment string | boolean The segment.
$idGoal integer | boolean The id of the goal to get data for. If this is set to false, data for every goal that belongs to $idSite is returned.
리턴 false | Piwik\DataTable

getGoal() 공개 메소드

Return a single goal.
public getGoal ( integer $idSite, integer $idGoal ) : array
$idSite integer
$idGoal integer
리턴 array An array of goal attributes.

getGoalSpecificDataTable() 보호된 메소드

Utility method that retrieve an archived DataTable for a specific site, date range, segment and goal. If not goal is specified, this method will retrieve and sum the data for every goal.
protected getGoalSpecificDataTable ( string $recordName, integer | string $idSite, string $period, string $date, string $segment, integer | boolean $idGoal ) : false | DataTable
$recordName string The archive entry name.
$idSite integer | string The site(s) to select data for.
$period string The period type.
$date string The date type.
$segment string The segment.
$idGoal integer | boolean The id of the goal to get data for. If this is set to false, data for every goal that belongs to $idSite is returned.
리턴 false | Piwik\DataTable

getGoals() 공개 메소드

Returns all Goals for a given website, or list of websites
public getGoals ( string | array $idSite ) : array
$idSite string | array Array or Comma separated list of website IDs to request the goals for
리턴 array Array of Goal attributes

getItems() 보호된 메소드

Returns a datatable of Items SKU/name or categories and their metrics If $abandonedCarts set to 1, will return items abandoned in carts. If set to 0, will return items ordered
protected getItems ( $recordName, $idSite, $period, $date, $abandonedCarts, $segment )

getItemsCategory() 공개 메소드

public getItemsCategory ( $idSite, $period, $date, $abandonedCarts = false, $segment = false )

getItemsName() 공개 메소드

public getItemsName ( $idSite, $period, $date, $abandonedCarts = false, $segment = false )

getItemsSku() 공개 메소드

public getItemsSku ( $idSite, $period, $date, $abandonedCarts = false, $segment = false )

getMetrics() 공개 메소드

Similar to {@link get()} but does not return any metrics for new and returning visitors. It won't apply any segment by default. This method is deprecated from the API as it is only there to make the implementation of the actual {@link get()} method easy.
사용 중단:
public getMetrics ( $idSite, $period, $date, $segment = false, $idGoal = false, $columns = [] )

getNbVisitsConverted() 공개 메소드

public getNbVisitsConverted ( $idSite, $period, $date, $segment = false, $idGoal = false )

getNumeric() 보호된 메소드

protected getNumeric ( $idSite, $period, $date, $segment, $toFetch )

getRevenue() 공개 메소드

public getRevenue ( $idSite, $period, $date, $segment = false, $idGoal = false )

getVisitsUntilConversion() 공개 메소드

Gets a DataTable that maps ranges of visit counts to the number of conversions that occurred on those visits for the specified site, date range, segment and goal.
public getVisitsUntilConversion ( integer $idSite, string $period, string $date, string | boolean $segment = false, integer | boolean $idGoal = false ) : boolean | DataTable
$idSite integer The site to select data from.
$period string The period type.
$date string The date type.
$segment string | boolean The segment.
$idGoal integer | boolean The id of the goal to get data for. If this is set to false, data for every goal that belongs to $idSite is returned.
리턴 boolean | Piwik\DataTable

renameNotDefinedRow() 보호된 메소드

protected renameNotDefinedRow ( $dataTable, $notDefinedStringPretty )

updateGoal() 공개 메소드

Will not update or re-process the conversions already recorded
또한 보기: addGoal() for parameters description
public updateGoal ( integer $idSite, integer $idGoal, $name, $matchAttribute, string $pattern, string $patternType, boolean $caseSensitive = false, boolean | float $revenue = false, boolean $allowMultipleConversionsPerVisit = false, string $description = '' ) : void
$idSite integer
$idGoal integer
$name
$matchAttribute
$pattern string
$patternType string
$caseSensitive boolean
$revenue boolean | float
$allowMultipleConversionsPerVisit boolean
$description string
리턴 void