Piwik
extends AbstractHelper
in package
Piwik Web Analytics view helper
Tags
Table of Contents
- $customVars : bool
- Whether to track use custom variables to track additional information
- $disableCookies : bool
- Whether to disable cookies (see config.ini for details)
- $lightbox : bool
- Whether the tracker was initialized from lightbox.
- $params : array<string|int, mixed>
- Additional parameters
- $request : Request
- Request object
- $router : RouteMatch
- Router object
- $searchPrefix : string
- Search prefix (see config.ini for details)
- $siteId : int
- Piwik Site ID
- $timestamp : int
- A timestamp used to identify the init function to avoid name clashes when opening lightboxes.
- $url : string|bool
- Piwik URL (false if disabled)
- __construct() : mixed
- Constructor
- __invoke() : string
- Returns Piwik code (if active) or empty string if not.
- getClosingTrackingCode() : string
- Get the Finalization Part of the Tracking Code
- getCombinedSearchResults() : array<string|int, mixed>|null
- Get Combined Search Results if on a Results Page
- getCustomUrl() : string
- Get the custom URL of the Tracking Code
- getCustomVarsCode() : string
- Convert a Custom Variables Array to JavaScript Code
- getGenericCustomVars() : array<string|int, mixed>
- Get Custom Variables for a Generic Page View
- getLightboxCustomVars() : array<string|int, mixed>
- Get Custom Variables for lightbox actions
- getOpeningTrackingCode() : string
- Get the Initialization Part of the Tracking Code
- getRecordDriver() : AbstractBase|null
- Get Record Driver if on a Record Page
- getRecordPageCustomVars() : array<string|int, mixed>
- Get Custom Variables for a Record Page
- getSearchCustomVars() : array<string|int, mixed>
- Get Custom Variables for Search Results
- getSearchResults() : Results|null
- Get Search Results if on a Results Page
- getTrackCombinedSearchCode() : string
- Get Site Search Tracking Code for Combined Search
- getTrackPageViewCode() : string
- Get Page View Tracking Code
- getTrackSearchCode() : string
- Get Site Search Tracking Code
- trackCombinedSearch() : string
- Track a Combined Search
- trackPageView() : string
- Track a Generic Page View
- trackRecordPage() : string
- Track a Record View
- trackSearch() : string
- Track a Search
Properties
$customVars
Whether to track use custom variables to track additional information
protected
bool
$customVars
$disableCookies
Whether to disable cookies (see config.ini for details)
protected
bool
$disableCookies
$lightbox
Whether the tracker was initialized from lightbox.
protected
bool
$lightbox
$params
Additional parameters
protected
array<string|int, mixed>
$params
$request
Request object
protected
Request
$request
$router
Router object
protected
RouteMatch
$router
$searchPrefix
Search prefix (see config.ini for details)
protected
string
$searchPrefix
$siteId
Piwik Site ID
protected
int
$siteId
$timestamp
A timestamp used to identify the init function to avoid name clashes when opening lightboxes.
protected
int
$timestamp
$url
Piwik URL (false if disabled)
protected
string|bool
$url
Methods
__construct()
Constructor
public
__construct(string|bool $url, int|array<string|int, mixed> $options, bool $customVars, RouteMatch $router, Request $request) : mixed
Parameters
- $url : string|bool
-
Piwik address (false if disabled)
- $options : int|array<string|int, mixed>
-
Options array (or, if a single value, the Piwik site ID -- for backward compatibility)
- $customVars : bool
-
Whether to track additional information in custom variables
- $router : RouteMatch
-
Request
- $request : Request
-
Request
Return values
mixed —__invoke()
Returns Piwik code (if active) or empty string if not.
public
__invoke([array<string|int, mixed> $params = null ]) : string
Parameters
- $params : array<string|int, mixed> = null
-
Parameters
Return values
string —getClosingTrackingCode()
Get the Finalization Part of the Tracking Code
protected
getClosingTrackingCode() : string
Return values
string —JavaScript Code Fragment
getCombinedSearchResults()
Get Combined Search Results if on a Results Page
protected
getCombinedSearchResults() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —Array of search results or null if not on a combined search page
getCustomUrl()
Get the custom URL of the Tracking Code
protected
getCustomUrl() : string
Return values
string —URL
getCustomVarsCode()
Convert a Custom Variables Array to JavaScript Code
protected
getCustomVarsCode(array<string|int, mixed> $customVars) : string
Parameters
- $customVars : array<string|int, mixed>
-
Custom Variables
Return values
string —JavaScript Code Fragment
getGenericCustomVars()
Get Custom Variables for a Generic Page View
protected
getGenericCustomVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —Associative array of custom variables
getLightboxCustomVars()
Get Custom Variables for lightbox actions
protected
getLightboxCustomVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —Associative array of custom variables
getOpeningTrackingCode()
Get the Initialization Part of the Tracking Code
protected
getOpeningTrackingCode() : string
Return values
string —JavaScript Code Fragment
getRecordDriver()
Get Record Driver if on a Record Page
protected
getRecordDriver() : AbstractBase|null
Return values
AbstractBase|null —Record driver or null if not on a record page
getRecordPageCustomVars()
Get Custom Variables for a Record Page
protected
getRecordPageCustomVars(AbstractBase $recordDriver) : array<string|int, mixed>
Parameters
- $recordDriver : AbstractBase
-
Record driver
Return values
array<string|int, mixed> —Associative array of custom variables
getSearchCustomVars()
Get Custom Variables for Search Results
protected
getSearchCustomVars(Results $results) : array<string|int, mixed>
Parameters
- $results : Results
-
Search results
Return values
array<string|int, mixed> —Associative array of custom variables
getSearchResults()
Get Search Results if on a Results Page
protected
getSearchResults() : Results|null
Return values
Results|null —Search results or null if not on a search page
getTrackCombinedSearchCode()
Get Site Search Tracking Code for Combined Search
protected
getTrackCombinedSearchCode(Results $results, array<string|int, mixed> $combinedResults) : string
Parameters
- $results : Results
-
Search results
- $combinedResults : array<string|int, mixed>
-
Combined Search Results
Return values
string —JavaScript Code Fragment
getTrackPageViewCode()
Get Page View Tracking Code
protected
getTrackPageViewCode() : string
Return values
string —JavaScript Code Fragment
getTrackSearchCode()
Get Site Search Tracking Code
protected
getTrackSearchCode(Results $results) : string
Parameters
- $results : Results
-
Search results
Return values
string —JavaScript Code Fragment
trackCombinedSearch()
Track a Combined Search
protected
trackCombinedSearch(Results $results, array<string|int, mixed> $combinedResults) : string
Parameters
- $results : Results
-
Search Results
- $combinedResults : array<string|int, mixed>
-
Combined Search Results
Return values
string —Tracking Code
trackPageView()
Track a Generic Page View
protected
trackPageView() : string
Return values
string —Tracking Code
trackRecordPage()
Track a Record View
protected
trackRecordPage(AbstractBase $recordDriver) : string
Parameters
- $recordDriver : AbstractBase
-
Record Driver
Return values
string —Tracking Code
trackSearch()
Track a Search
protected
trackSearch(Results $results) : string
Parameters
- $results : Results
-
Search Results
Return values
string —Tracking Code