PHP 클래스 PiwikTracker, piwik-php-tracker

상속: extends Tracker
파일 보기 프로젝트 열기: piwik/piwik-php-tracker 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$DEBUG_APPEND_URL
$DEBUG_LAST_REQUESTED_URL Used in tests to output useful error messages.
$URL string Piwik base URL, for example http://example.org/piwik/ Must be set before using the class by calling PiwikTracker::$URL = 'http://yourwebsite.org/piwik/';

공개 메소드들

메소드 설명
__construct ( integer $idSite, string $apiUrl = '' ) Builds a PiwikTracker object, used to track visits, pages and Goal conversions for a specific website, by using the Piwik Tracking API.
addEcommerceItem ( string $sku, string $name = '', string | array $category = '', float | integer $price, integer $quantity = 1 ) Adds an item in the Ecommerce order.
clearCustomTrackingParameters ( ) Clear / reset all previously set custom tracking parameters.
clearCustomVariables ( ) Clears any Custom Variable that may be have been set.
deleteCookies ( ) Deletes all first party cookies from the client
disableCookieSupport ( ) By default, PiwikTracker will read first party cookies from the request and write updated cookies in the response (using setrawcookie).
disableSendImageResponse ( ) If image response is disabled Piwik will respond with a HTTP 204 header instead of responding with a gif.
doBulkTrack ( ) : string Sends all stored tracking actions at once. Only has an effect if bulk tracking is enabled.
doPing ( ) : mixed Sends a ping request.
doTrackAction ( string $actionUrl, string $actionType ) : mixed Tracks a download or outlink
doTrackContentImpression ( string $contentName, string $contentPiece = 'Unknown', string | boolean $contentTarget = false ) : mixed Tracks a content impression
doTrackContentInteraction ( string $interaction, string $contentName, string $contentPiece = 'Unknown', string | boolean $contentTarget = false ) : mixed Tracks a content interaction. Make sure you have tracked a content impression using the same content name and content piece, otherwise it will not count. To do so you should call the method doTrackContentImpression();
doTrackEcommerceCartUpdate ( float $grandTotal ) : mixed Tracks a Cart Update (add item, remove item, update item).
doTrackEcommerceOrder ( string | integer $orderId, float $grandTotal, float $subTotal, float $tax, float $shipping, float $discount ) : mixed Tracks an Ecommerce order.
doTrackEvent ( string $category, string $action, string | boolean $name = false, float | boolean $value = false ) : mixed Tracks an event
doTrackGoal ( integer $idGoal, float $revenue ) : mixed Records a Goal conversion
doTrackPageView ( string $documentTitle ) : mixed Tracks a page view
doTrackSiteSearch ( string $keyword, string $category = '', boolean | integer $countResults = false ) : mixed Tracks an internal Site Search query, and optionally tracks the Search Category, and Search results Count.
enableBulkTracking ( ) Enables the bulk request feature. When used, each tracking action is stored until the doBulkTrack method is called. This method will send all tracking data at once.
enableCookies ( string $domain = '', string $path = '/' ) Enable Cookie Creation - this will cause a first party VisitorId cookie to be set when the VisitorId is set or reset
getAttributionInfo ( ) : string Returns the currently assigned Attribution Information stored in a first party cookie.
getCustomVariable ( integer $id, string $scope = 'visit' ) : mixed Returns the currently assigned Custom Variable.
getRequestTimeout ( ) Returns the maximum number of seconds the tracker will spend waiting for a response from Piwik. Defaults to 600 seconds.
getUrlTrackAction ( string $actionUrl, string $actionType ) : string Builds URL to track a new action.
getUrlTrackContentImpression ( string $contentName, string $contentPiece, string | false $contentTarget ) : string Builds URL to track a content impression.
getUrlTrackContentInteraction ( string $interaction, string $contentName, string $contentPiece, string | false $contentTarget ) : string Builds URL to track a content impression.
getUrlTrackEcommerceCartUpdate ( $grandTotal ) Returns URL used to track Ecommerce Cart updates Calling this function will reinitializes the property ecommerceItems to empty array so items will have to be added again via addEcommerceItem()
getUrlTrackEcommerceOrder ( $orderId, $grandTotal, $subTotal, $tax, $shipping, $discount ) Returns URL used to track Ecommerce Orders Calling this function will reinitializes the property ecommerceItems to empty array so items will have to be added again via addEcommerceItem()
getUrlTrackEvent ( string $category, string $action, string | boolean $name = false, float | boolean $value = false ) : string Builds URL to track a custom event.
getUrlTrackGoal ( integer $idGoal, float $revenue ) : string Builds URL to track a goal with idGoal and revenue.
getUrlTrackPageView ( string $documentTitle = '' ) : string Builds URL to track a page view.
getUrlTrackSiteSearch ( string $keyword, string $category, integer $countResults ) : string Builds URL to track a site search.
getUserId ( ) : boolean Returns the User ID string, which may have been set via: $v->setUserId('[email protected]');
getUserIdHashed ( $id ) : string Hash function used internally by Piwik to hash a User ID into the Visitor ID.
getVisitorId ( ) : string If the user initiating the request has the Piwik first party cookie, this function will try and return the ID parsed from this first party cookie (found in $_COOKIE).
setAttributionInfo ( string $jsonEncoded ) Sets the attribution information to the visit, so that subsequent Goal conversions are properly attributed to the right Referrer URL, timestamp, Campaign Name & Keyword.
setBrowserHasCookies ( boolean $bool ) Sets if the browser supports cookies This is reported in "List of plugins" report in Piwik.
setBrowserLanguage ( string $acceptLanguage ) Sets the Browser language. Used to guess visitor countries when GeoIP is not enabled
setCity ( string $city ) Sets the city of the visitor. If not used, Piwik may try to find the city using the visitor's IP address (if configured to do so).
setCountry ( string $country ) Sets the country of the visitor. If not used, Piwik will try to find the country using either the visitor's IP address or language.
setCustomTrackingParameter ( string $trackingApiParameter, string $value ) Sets a custom tracking parameter. This is useful if you need to send any tracking parameters for a 3rd party plugin that is not shipped with Piwik itself. Please note that custom parameters are cleared after each tracking request.
setCustomVariable ( integer $id, string $name, string $value, string $scope = 'visit' ) Sets Visit Custom Variable.
setDebugStringAppend ( string $string ) Will append a custom string at the end of the Tracking request.
setEcommerceView ( string $sku = '', string $name = '', string | array $category = '', float $price ) Sets the current page view as an item (product) page view, or an Ecommerce Category page view.
setForceNewVisit ( ) Forces Piwik to create a new visit for the tracking request.
setForceVisitDateTime ( string $dateTime ) Overrides server date and time for the tracking requests.
setGenerationTime ( integer $timeMs ) Sets the time that generating the document on the server side took.
setIdSite ( integer $idSite ) Sets the current site ID.
setIp ( string $ip ) Overrides IP address
setLatitude ( float $lat ) Sets the latitude of the visitor. If not used, Piwik may try to find the visitor's latitude using the visitor's IP address (if configured to do so).
setLocalTime ( string $time ) Sets local visitor time
setLongitude ( float $long ) Sets the longitude of the visitor. If not used, Piwik may try to find the visitor's longitude using the visitor's IP address (if configured to do so).
setNewVisitorId ( ) Sets the current visitor ID to a random new one.
setPageCharset ( string $charset = '' ) By default, Piwik expects utf-8 encoded values, for example for the page URL parameter values, Page Title, etc.
setPlugins ( boolean $flash = false, boolean $java = false, boolean $director = false, boolean $quickTime = false, boolean $realPlayer = false, boolean $pdf = false, boolean $windowsMedia = false, boolean $gears = false, boolean $silverlight = false ) Sets visitor browser supported plugins
setProxy ( string $proxy, integer $proxyPort = 80 ) If a proxy is needed to look up the address of the Piwik site, set it with this
setRegion ( string $region ) Sets the region of the visitor. If not used, Piwik may try to find the region using the visitor's IP address (if configured to do so).
setRequestTimeout ( integer $timeout ) Sets the maximum number of seconds that the tracker will spend waiting for a response from Piwik.
setResolution ( integer $width, integer $height ) Sets user resolution width and height.
setTokenAuth ( string $token_auth ) Some Tracking API functionality requires express authentication, using either the Super User token_auth, or a user with 'admin' access to the website.
setUrl ( string $url ) Sets the current URL being tracked
setUrlReferer ( $url )
setUrlReferrer ( string $url ) Sets the URL referrer used to track Referrers details for new visits.
setUserAgent ( string $userAgent ) Sets the user agent, used to detect OS and browser.
setUserId ( string $userId ) Force the action to be recorded for a specific User. The User ID is a string representing a given user in your system.
setVisitorId ( string $visitorId ) Forces the requests to be recorded for the specified Visitor ID.

보호된 메소드들

메소드 설명
domainFixup ( $domain ) Fix-up domain
getBaseUrl ( ) Returns the base URL for the piwik server.
getCookieMatchingName ( string $name ) : string Returns a first party cookie which name contains $name
getCookieName ( string $cookieName ) : string Get cookie name with prefix and domain hash
getCurrentHost ( ) : string If current URL is "http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return "http://example.org"
getCurrentQueryString ( ) : string If current URL is "http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return "?param1=value1¶m2=value2"
getCurrentScheme ( ) : string If the current URL is 'http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return 'http'
getCurrentScriptName ( ) : string If current URL is "http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return "/dir1/dir2/index.php"
getCurrentUrl ( ) : string Returns the current full URL (scheme, host, path and query string.
getCustomVariablesFromCookie ( ) : boolean | mixed
getRequest ( $idSite )
getTimestamp ( ) : string | integer Returns current timestamp, or forced timestamp/datetime if it was set
getUrlTrackEcommerce ( $grandTotal, $subTotal, $tax, $shipping, $discount ) Returns URL used to track Ecommerce orders
loadVisitorIdCookie ( ) : boolean Loads values from the VisitorId Cookie
sendRequest ( $url, $method = 'GET', $data = null, $force = false )
setCookie ( $cookieName, $cookieValue, $cookieTTL ) Sets a first party cookie to the client to improve dual JS-PHP tracking.
setFirstPartyCookies ( ) Sets the first party cookies as would the piwik.js All cookies are supported: 'id' and 'ses' and 'ref' and 'cvar' cookies.

비공개 메소드들

메소드 설명
forceDotAsSeparatorForDecimalPoint ( float | string $value ) : string Force the separator for decimal point to be a dot. See https://github.com/piwik/piwik/issues/6435 If for instance a German locale is used it would be a comma otherwise.
getProxy ( ) If the proxy IP and the proxy port have been set, with the setProxy() function returns a string, like "173.234.92.107:80"

메소드 상세

__construct() 공개 메소드

Builds a PiwikTracker object, used to track visits, pages and Goal conversions for a specific website, by using the Piwik Tracking API.
public __construct ( integer $idSite, string $apiUrl = '' )
$idSite integer Id site to be tracked
$apiUrl string "http://example.org/piwik/" or "http://piwik.example.org/" If set, will overwrite PiwikTracker::$URL

addEcommerceItem() 공개 메소드

This should be called before doTrackEcommerceOrder(), or before doTrackEcommerceCartUpdate(). This function can be called for all individual products in the cart (or order). SKU parameter is mandatory. Other parameters are optional (set to false if value not known). Ecommerce items added via this function are automatically cleared when doTrackEcommerceOrder() or getUrlTrackEcommerceOrder() is called.
public addEcommerceItem ( string $sku, string $name = '', string | array $category = '', float | integer $price, integer $quantity = 1 )
$sku string (required) SKU, Product identifier
$name string (optional) Product name
$category string | array (optional) Product category, or array of product categories (up to 5 categories can be specified for a given product)
$price float | integer (optional) Individual product price (supports integer and decimal prices)
$quantity integer (optional) Product quantity. If not specified, will default to 1 in the Reports

clearCustomTrackingParameters() 공개 메소드

Clear / reset all previously set custom tracking parameters.

clearCustomVariables() 공개 메소드

This can be useful when you have enabled bulk requests, and you wish to clear Custom Variables of 'visit' scope.

deleteCookies() 공개 메소드

Deletes all first party cookies from the client
public deleteCookies ( )

disableCookieSupport() 공개 메소드

This can be disabled by calling this function.

disableSendImageResponse() 공개 메소드

If image response is disabled Piwik will respond with a HTTP 204 header instead of responding with a gif.

doBulkTrack() 공개 메소드

To enable bulk tracking, call enableBulkTracking().
public doBulkTrack ( ) : string
리턴 string Response

doPing() 공개 메소드

Ping requests do not track new actions. If they are sent within the standard visit length (see global.ini.php), they will extend the existing visit and the current last action for the visit. If after the standard visit length, ping requests will create a new visit using the last action in the last known visit.
public doPing ( ) : mixed
리턴 mixed Response or true if using bulk request

doTrackAction() 공개 메소드

Tracks a download or outlink
public doTrackAction ( string $actionUrl, string $actionType ) : mixed
$actionUrl string URL of the download or outlink
$actionType string Type of the action: 'download' or 'link'
리턴 mixed Response or true if using bulk request

doTrackContentImpression() 공개 메소드

Tracks a content impression
public doTrackContentImpression ( string $contentName, string $contentPiece = 'Unknown', string | boolean $contentTarget = false ) : mixed
$contentName string The name of the content. For instance 'Ad Foo Bar'
$contentPiece string The actual content. For instance the path to an image, video, audio, any text
$contentTarget string | boolean (optional) The target of the content. For instance the URL of a landing page.
리턴 mixed Response string or true if using bulk requests.

doTrackContentInteraction() 공개 메소드

Tracks a content interaction. Make sure you have tracked a content impression using the same content name and content piece, otherwise it will not count. To do so you should call the method doTrackContentImpression();
public doTrackContentInteraction ( string $interaction, string $contentName, string $contentPiece = 'Unknown', string | boolean $contentTarget = false ) : mixed
$interaction string The name of the interaction with the content. For instance a 'click'
$contentName string The name of the content. For instance 'Ad Foo Bar'
$contentPiece string The actual content. For instance the path to an image, video, audio, any text
$contentTarget string | boolean (optional) The target the content leading to when an interaction occurs. For instance the URL of a landing page.
리턴 mixed Response string or true if using bulk requests.

doTrackEcommerceCartUpdate() 공개 메소드

On every Cart update, you must call addEcommerceItem() for each item (product) in the cart, including the items that haven't been updated since the last cart update. Items which were in the previous cart and are not sent in later Cart updates will be deleted from the cart (in the database).
public doTrackEcommerceCartUpdate ( float $grandTotal ) : mixed
$grandTotal float Cart grandTotal (typically the sum of all items' prices)
리턴 mixed Response or true if using bulk request

doTrackEcommerceOrder() 공개 메소드

If the Ecommerce order contains items (products), you must call first the addEcommerceItem() for each item in the order. All revenues (grandTotal, subTotal, tax, shipping, discount) will be individually summed and reported in Piwik reports. Only the parameters $orderId and $grandTotal are required.
public doTrackEcommerceOrder ( string | integer $orderId, float $grandTotal, float $subTotal, float $tax, float $shipping, float $discount ) : mixed
$orderId string | integer (required) Unique Order ID. This will be used to count this order only once in the event the order page is reloaded several times. orderId must be unique for each transaction, even on different days, or the transaction will not be recorded by Piwik.
$grandTotal float (required) Grand Total revenue of the transaction (including tax, shipping, etc.)
$subTotal float (optional) Sub total amount, typically the sum of items prices for all items in this order (before Tax and Shipping costs are applied)
$tax float (optional) Tax amount for this order
$shipping float (optional) Shipping amount for this order
$discount float (optional) Discounted amount in this order
리턴 mixed Response or true if using bulk request

doTrackEvent() 공개 메소드

Tracks an event
public doTrackEvent ( string $category, string $action, string | boolean $name = false, float | boolean $value = false ) : mixed
$category string The Event Category (Videos, Music, Games...)
$action string The Event's Action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...)
$name string | boolean (optional) The Event's object Name (a particular Movie name, or Song name, or File name...)
$value float | boolean (optional) The Event's value
리턴 mixed Response string or true if using bulk requests.

doTrackGoal() 공개 메소드

Records a Goal conversion
public doTrackGoal ( integer $idGoal, float $revenue ) : mixed
$idGoal integer Id Goal to record a conversion
$revenue float Revenue for this conversion
리턴 mixed Response or true if using bulk request

doTrackPageView() 공개 메소드

Tracks a page view
public doTrackPageView ( string $documentTitle ) : mixed
$documentTitle string Page title as it will appear in the Actions > Page titles report
리턴 mixed Response string or true if using bulk requests.

doTrackSiteSearch() 공개 메소드

These are used to populate reports in Actions > Site Search.
public doTrackSiteSearch ( string $keyword, string $category = '', boolean | integer $countResults = false ) : mixed
$keyword string Searched query on the site
$category string (optional) Search engine category if applicable
$countResults boolean | integer (optional) results displayed on the search result page. Used to track "zero result" keywords.
리턴 mixed Response or true if using bulk requests.

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

Fix-up domain
protected static domainFixup ( $domain )

enableBulkTracking() 공개 메소드

Enables the bulk request feature. When used, each tracking action is stored until the doBulkTrack method is called. This method will send all tracking data at once.
public enableBulkTracking ( )

enableCookies() 공개 메소드

Enable Cookie Creation - this will cause a first party VisitorId cookie to be set when the VisitorId is set or reset
public enableCookies ( string $domain = '', string $path = '/' )
$domain string (optional) Set first-party cookie domain. Accepted values: example.com, *.example.com (same as .example.com) or subdomain.example.com
$path string (optional) Set first-party cookie path

getAttributionInfo() 공개 메소드

This function will only work if the user is initiating the current request, and his cookies can be read by PHP from the $_COOKIE array.
public getAttributionInfo ( ) : string
리턴 string JSON Encoded string containing the Referrer information for Goal conversion attribution. Will return false if the cookie could not be found

getBaseUrl() 보호된 메소드

Returns the base URL for the piwik server.
protected getBaseUrl ( )

getCookieMatchingName() 보호된 메소드

Returns a first party cookie which name contains $name
protected getCookieMatchingName ( string $name ) : string
$name string
리턴 string String value of cookie, or false if not found

getCookieName() 보호된 메소드

Get cookie name with prefix and domain hash
protected getCookieName ( string $cookieName ) : string
$cookieName string
리턴 string

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

If current URL is "http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return "http://example.org"
protected static getCurrentHost ( ) : string
리턴 string

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

If current URL is "http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return "?param1=value1¶m2=value2"
protected static getCurrentQueryString ( ) : string
리턴 string

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

If the current URL is 'http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return 'http'
protected static getCurrentScheme ( ) : string
리턴 string 'https' or 'http'

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

If current URL is "http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2" will return "/dir1/dir2/index.php"
protected static getCurrentScriptName ( ) : string
리턴 string

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

Returns the current full URL (scheme, host, path and query string.
protected static getCurrentUrl ( ) : string
리턴 string

getCustomVariable() 공개 메소드

If scope is 'visit', it will attempt to read the value set in the first party cookie created by Piwik Tracker ($_COOKIE array).
public getCustomVariable ( integer $id, string $scope = 'visit' ) : mixed
$id integer Custom Variable integer index to fetch from cookie. Should be a value from 1 to 5
$scope string Custom variable scope. Possible values: visit, page, event
리턴 mixed An array with this format: array( 0 => CustomVariableName, 1 => CustomVariableValue ) or false

getCustomVariablesFromCookie() 보호된 메소드

getRequest() 보호된 메소드

protected getRequest ( $idSite )

getRequestTimeout() 공개 메소드

Returns the maximum number of seconds the tracker will spend waiting for a response from Piwik. Defaults to 600 seconds.
public getRequestTimeout ( )

getTimestamp() 보호된 메소드

Returns current timestamp, or forced timestamp/datetime if it was set
protected getTimestamp ( ) : string | integer
리턴 string | integer

getUrlTrackAction() 공개 메소드

Builds URL to track a new action.
또한 보기: doTrackAction()
public getUrlTrackAction ( string $actionUrl, string $actionType ) : string
$actionUrl string URL of the download or outlink
$actionType string Type of the action: 'download' or 'link'
리턴 string URL to piwik.php with all parameters set to track an action

getUrlTrackContentImpression() 공개 메소드

Builds URL to track a content impression.
또한 보기: doTrackContentImpression()
public getUrlTrackContentImpression ( string $contentName, string $contentPiece, string | false $contentTarget ) : string
$contentName string The name of the content. For instance 'Ad Foo Bar'
$contentPiece string The actual content. For instance the path to an image, video, audio, any text
$contentTarget string | false (optional) The target of the content. For instance the URL of a landing page.
리턴 string URL to piwik.php with all parameters set to track the pageview

getUrlTrackContentInteraction() 공개 메소드

Builds URL to track a content impression.
또한 보기: doTrackContentInteraction()
public getUrlTrackContentInteraction ( string $interaction, string $contentName, string $contentPiece, string | false $contentTarget ) : string
$interaction string The name of the interaction with the content. For instance a 'click'
$contentName string The name of the content. For instance 'Ad Foo Bar'
$contentPiece string The actual content. For instance the path to an image, video, audio, any text
$contentTarget string | false (optional) The target the content leading to when an interaction occurs. For instance the URL of a landing page.
리턴 string URL to piwik.php with all parameters set to track the pageview

getUrlTrackEcommerce() 보호된 메소드

Calling this function will reinitializes the property ecommerceItems to empty array so items will have to be added again via addEcommerceItem()
protected getUrlTrackEcommerce ( $grandTotal, $subTotal, $tax, $shipping, $discount )

getUrlTrackEcommerceCartUpdate() 공개 메소드

Returns URL used to track Ecommerce Cart updates Calling this function will reinitializes the property ecommerceItems to empty array so items will have to be added again via addEcommerceItem()
public getUrlTrackEcommerceCartUpdate ( $grandTotal )

getUrlTrackEcommerceOrder() 공개 메소드

Returns URL used to track Ecommerce Orders Calling this function will reinitializes the property ecommerceItems to empty array so items will have to be added again via addEcommerceItem()
public getUrlTrackEcommerceOrder ( $orderId, $grandTotal, $subTotal, $tax, $shipping, $discount )

getUrlTrackEvent() 공개 메소드

Builds URL to track a custom event.
또한 보기: doTrackEvent()
public getUrlTrackEvent ( string $category, string $action, string | boolean $name = false, float | boolean $value = false ) : string
$category string The Event Category (Videos, Music, Games...)
$action string The Event's Action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...)
$name string | boolean (optional) The Event's object Name (a particular Movie name, or Song name, or File name...)
$value float | boolean (optional) The Event's value
리턴 string URL to piwik.php with all parameters set to track the pageview

getUrlTrackGoal() 공개 메소드

Builds URL to track a goal with idGoal and revenue.
또한 보기: doTrackGoal()
public getUrlTrackGoal ( integer $idGoal, float $revenue ) : string
$idGoal integer Id Goal to record a conversion
$revenue float Revenue for this conversion
리턴 string URL to piwik.php with all parameters set to track the goal conversion

getUrlTrackPageView() 공개 메소드

Builds URL to track a page view.
또한 보기: doTrackPageView()
public getUrlTrackPageView ( string $documentTitle = '' ) : string
$documentTitle string Page view name as it will appear in Piwik reports
리턴 string URL to piwik.php with all parameters set to track the pageview

getUrlTrackSiteSearch() 공개 메소드

Builds URL to track a site search.
또한 보기: doTrackSiteSearch()
public getUrlTrackSiteSearch ( string $keyword, string $category, integer $countResults ) : string
$keyword string
$category string
$countResults integer
리턴 string

getUserId() 공개 메소드

Returns the User ID string, which may have been set via: $v->setUserId('[email protected]');
public getUserId ( ) : boolean
리턴 boolean

getUserIdHashed() 공개 정적인 메소드

Note: matches implementation of Tracker\Request->getUserIdHashed()
public static getUserIdHashed ( $id ) : string
$id
리턴 string

getVisitorId() 공개 메소드

If you call this function from a server, where the call is triggered by a cron or script not initiated by the actual visitor being tracked, then it will return the random Visitor ID that was assigned to this visit object. This can be used if you wish to record more visits, actions or goals for this visitor ID later on.
public getVisitorId ( ) : string
리턴 string 16 hex chars visitor ID string

loadVisitorIdCookie() 보호된 메소드

Loads values from the VisitorId Cookie
protected loadVisitorIdCookie ( ) : boolean
리턴 boolean True if cookie exists and is valid, False otherwise

sendRequest() 보호된 메소드

protected sendRequest ( $url, $method = 'GET', $data = null, $force = false )

setAttributionInfo() 공개 메소드

This must be a JSON encoded string that would typically be fetched from the JS API: piwikTracker.getAttributionInfo() and that you have JSON encoded via JSON2.stringify() If you call enableCookies() then these referral attribution values will be set to the 'ref' first party cookie storing referral information.
또한 보기: function getAttributionInfo() in https://github.com/piwik/piwik/blob/master/js/piwik.js
public setAttributionInfo ( string $jsonEncoded )
$jsonEncoded string JSON encoded array containing Attribution info

setBrowserHasCookies() 공개 메소드

Sets if the browser supports cookies This is reported in "List of plugins" report in Piwik.
public setBrowserHasCookies ( boolean $bool )
$bool boolean

setBrowserLanguage() 공개 메소드

Sets the Browser language. Used to guess visitor countries when GeoIP is not enabled
public setBrowserLanguage ( string $acceptLanguage )
$acceptLanguage string For example "fr-fr"

setCity() 공개 메소드

Allowed only for Admin/Super User, must be used along with setTokenAuth().
public setCity ( string $city )
$city string

setCookie() 보호된 메소드

This replicates the piwik.js tracker algorithms for consistency and better accuracy.
protected setCookie ( $cookieName, $cookieValue, $cookieTTL )
$cookieName
$cookieValue
$cookieTTL

setCountry() 공개 메소드

Allowed only for Admin/Super User, must be used along with setTokenAuth().
public setCountry ( string $country )
$country string

setCustomTrackingParameter() 공개 메소드

Sets a custom tracking parameter. This is useful if you need to send any tracking parameters for a 3rd party plugin that is not shipped with Piwik itself. Please note that custom parameters are cleared after each tracking request.
public setCustomTrackingParameter ( string $trackingApiParameter, string $value )
$trackingApiParameter string The name of the tracking API parameter, eg 'dimension1'
$value string Tracking parameter value that shall be sent for this tracking parameter.

setCustomVariable() 공개 메소드

See http://piwik.org/docs/custom-variables/
public setCustomVariable ( integer $id, string $name, string $value, string $scope = 'visit' )
$id integer Custom variable slot ID from 1-5
$name string Custom variable name
$value string Custom variable value
$scope string Custom variable scope. Possible values: visit, page, event

setDebugStringAppend() 공개 메소드

Will append a custom string at the end of the Tracking request.
public setDebugStringAppend ( string $string )
$string string

setEcommerceView() 공개 메소드

This must be called before doTrackPageView() on this product/category page. It will set 3 custom variables of scope "page" with the SKU, Name and Category for this page view. Note: Custom Variables of scope "page" slots 3, 4 and 5 will be used. On a category page, you may set the parameter $category only and set the other parameters to false. Tracking Product/Category page views will allow Piwik to report on Product & Categories conversion rates (Conversion rate = Ecommerce orders containing this product or category / Visits to the product or category)
public setEcommerceView ( string $sku = '', string $name = '', string | array $category = '', float $price )
$sku string Product SKU being viewed
$name string Product Name being viewed
$category string | array Category being viewed. On a Product page, this is the product's category. You can also specify an array of up to 5 categories for a given page view.
$price float Specify the price at which the item was displayed

setFirstPartyCookies() 보호된 메소드

Sets the first party cookies as would the piwik.js All cookies are supported: 'id' and 'ses' and 'ref' and 'cvar' cookies.
protected setFirstPartyCookies ( )

setForceNewVisit() 공개 메소드

By default, Piwik will create a new visit if the last request by this user was more than 30 minutes ago. If you call setForceNewVisit() before calling doTrack*, then a new visit will be created for this request.
public setForceNewVisit ( )

setForceVisitDateTime() 공개 메소드

By default Piwik will track requests for the "current datetime" but this function allows you to track visits in the past. All times are in UTC. Allowed only for Super User, must be used along with setTokenAuth()
또한 보기: setTokenAuth()
public setForceVisitDateTime ( string $dateTime )
$dateTime string Date with the format 'Y-m-d H:i:s', or a UNIX timestamp

setGenerationTime() 공개 메소드

Sets the time that generating the document on the server side took.
public setGenerationTime ( integer $timeMs )
$timeMs integer Generation time in ms

setIdSite() 공개 메소드

Sets the current site ID.
public setIdSite ( integer $idSite )
$idSite integer

setIp() 공개 메소드

Allowed only for Super User, must be used along with setTokenAuth()
또한 보기: setTokenAuth()
public setIp ( string $ip )
$ip string IP string, eg. 130.54.2.1

setLatitude() 공개 메소드

Allowed only for Admin/Super User, must be used along with setTokenAuth().
public setLatitude ( float $lat )
$lat float

setLocalTime() 공개 메소드

Sets local visitor time
public setLocalTime ( string $time )
$time string HH:MM:SS format

setLongitude() 공개 메소드

Allowed only for Admin/Super User, must be used along with setTokenAuth().
public setLongitude ( float $long )
$long float

setNewVisitorId() 공개 메소드

Sets the current visitor ID to a random new one.
public setNewVisitorId ( )

setPageCharset() 공개 메소드

It is recommended to only send UTF-8 data to Piwik. If required though, you can also specify another charset using this function.
public setPageCharset ( string $charset = '' )
$charset string

setPlugins() 공개 메소드

Sets visitor browser supported plugins
public setPlugins ( boolean $flash = false, boolean $java = false, boolean $director = false, boolean $quickTime = false, boolean $realPlayer = false, boolean $pdf = false, boolean $windowsMedia = false, boolean $gears = false, boolean $silverlight = false )
$flash boolean
$java boolean
$director boolean
$quickTime boolean
$realPlayer boolean
$pdf boolean
$windowsMedia boolean
$gears boolean
$silverlight boolean

setProxy() 공개 메소드

If a proxy is needed to look up the address of the Piwik site, set it with this
public setProxy ( string $proxy, integer $proxyPort = 80 )
$proxy string IP as string, for example "173.234.92.107"
$proxyPort integer

setRegion() 공개 메소드

Allowed only for Admin/Super User, must be used along with setTokenAuth().
public setRegion ( string $region )
$region string

setRequestTimeout() 공개 메소드

Sets the maximum number of seconds that the tracker will spend waiting for a response from Piwik.
public setRequestTimeout ( integer $timeout )
$timeout integer

setResolution() 공개 메소드

Sets user resolution width and height.
public setResolution ( integer $width, integer $height )
$width integer
$height integer

setTokenAuth() 공개 메소드

The following features require access: - force the visitor IP - force the date & time of the tracking requests rather than track for the current datetime
public setTokenAuth ( string $token_auth )
$token_auth string token_auth 32 chars token_auth string

setUrl() 공개 메소드

Sets the current URL being tracked
public setUrl ( string $url )
$url string Raw URL (not URL encoded)

setUrlReferer() 공개 메소드

사용 중단:
public setUrlReferer ( $url )

setUrlReferrer() 공개 메소드

Sets the URL referrer used to track Referrers details for new visits.
public setUrlReferrer ( string $url )
$url string Raw URL (not URL encoded)

setUserAgent() 공개 메소드

If this function is not called, the User Agent will default to the current user agent.
public setUserAgent ( string $userAgent )
$userAgent string

setUserId() 공개 메소드

A User ID can be a username, UUID or an email address, or any number or string that uniquely identifies a user or client.
public setUserId ( string $userId )
$userId string Any user ID string (eg. email address, ID, username). Must be non empty. Set to false to de-assign a user id previously set.

setVisitorId() 공개 메소드

Note: it is recommended to use ->setUserId($userId); instead. Rather than letting Piwik attribute the user with a heuristic based on IP and other user fingeprinting attributes, force the action to be recorded for a particular visitor. If you use both setVisitorId and setUserId, setUserId will take precedence. If not set, the visitor ID will be fetched from the 1st party cookie, or will be set to a random UUID.
사용 중단: We recommend to use ->setUserId($userId).
public setVisitorId ( string $visitorId )
$visitorId string 16 hexadecimal characters visitor ID, eg. "33c31e01394bdc63"

프로퍼티 상세

$DEBUG_APPEND_URL 공개적으로 프로퍼티

public $DEBUG_APPEND_URL

$DEBUG_LAST_REQUESTED_URL 공개적으로 정적으로 프로퍼티

Used in tests to output useful error messages.
public static $DEBUG_LAST_REQUESTED_URL

$URL 공개적으로 정적으로 프로퍼티

Piwik base URL, for example http://example.org/piwik/ Must be set before using the class by calling PiwikTracker::$URL = 'http://yourwebsite.org/piwik/';
public static string $URL
리턴 string