Method | Description | |
---|---|---|
__construct ( |
||
addSite ( string $siteName, array | string $urls = null, integer $ecommerce = null, null $siteSearch = null, string $searchKeywordParameters = null, string $searchCategoryParameters = null, string $excludedIps = null, null $excludedQueryParameters = null, string $timezone = null, string $currency = null, string $group = null, string $startDate = null, null | string $excludedUserAgents = null, integer $keepURLFragments = null, string $type = null, array | null $settingValues = null, boolean | null $excludeUnknownUrls = null ) : integer | Add a website. | |
addSiteAliasUrls ( integer $idSite, array | string $urls ) : integer | Add a list of alias Urls to the given idSite | |
deleteSite ( integer $idSite ) | Delete a website from the database, given its Id. The method deletes the actual site as well as some associated data. However, it does not delete any logs or archives that belong to this website. You can delete logs and archives for a site manually as described in this FAQ: http://piwik.org/faq/how-to/faq_73/ . | |
getAllSites ( ) : array | Returns all websites, requires Super User access | |
getAllSitesId ( ) : array | Returns the list of all the website IDs registered. | |
getCurrencyList ( ) : array | Returns the list of supported currencies | |
getCurrencySymbols ( ) : array( | Returns the list of currency symbols | |
getDefaultCurrency ( ) : string | Returns the default currency that will be set when creating a website through the API. | |
getDefaultTimezone ( ) : string | Returns the default timezone that will be set when creating a website through the API. | |
getExcludedIpsGlobal ( ) : string | Returns the list of IPs that are excluded from all websites | |
getExcludedQueryParametersGlobal ( ) : string | Returns the list of URL query parameters that are excluded from all websites | |
getExcludedUserAgentsGlobal ( ) : string | Returns the list of user agent substrings to look for when excluding visits for all websites. If a visitor's user agent string contains one of these substrings, their visits will not be included. | |
getImageTrackingCode ( integer $idSite, string $piwikUrl = '', $actionName = false, integer $idGoal = false, integer $revenue = false ) : string | Returns image link tracking code for a given site with specified options. | |
getIpsForRange ( string $ipRange ) : array | false | Get the start and end IP addresses for an IP address range | |
getJavascriptTag ( integer $idSite, string $piwikUrl = '', boolean $mergeSubdomains = false, boolean $groupPageTitlesByDomain = false, boolean $mergeAliasUrls = false, boolean $visitorCustomVariables = false, boolean $pageCustomVariables = false, boolean $customCampaignNameQueryParam = false, boolean $customCampaignKeywordParam = false, boolean $doNotTrack = false, boolean $disableCookies = false, boolean $trackNoScript = false ) : string | Returns the javascript tag for the given idSite. | |
getKeepURLFragmentsGlobal ( ) : boolean | Returns true if the default behavior is to keep URL fragments when tracking, false if otherwise. | |
getNumWebsitesToDisplayPerPage ( ) : integer | Returns the number of websites to display per page. | |
getPatternMatchSites ( string $pattern, integer | false $limit = false ) : array | Find websites matching the given pattern. | |
getSearchCategoryParametersGlobal ( ) : string | ||
getSearchKeywordParametersGlobal ( ) : string | ||
getSiteFromId ( integer $idSite ) : array | Returns the website information : name, main_url | |
getSiteSettings ( $idSite ) | ||
getSiteUrlsFromId ( integer $idSite ) : array | Returns the list of all URLs registered for the given idSite (main_url + alias URLs). | |
getSitesFromGroup ( string $group = '' ) : array | Returns all websites belonging to the specified group | |
getSitesGroups ( ) : array | Returns the list of website groups, including the empty group if no group were specified for some websites | |
getSitesIdFromSiteUrl ( string $url ) : array | Returns the list of websites ID associated with a URL. | |
getSitesIdFromTimezones ( array $timezones ) : array | Returns all websites with a timezone matching one the specified timezones | |
getSitesIdWithAdminAccess ( ) : array | Returns the list of websites ID with the 'admin' access for the current user. | |
getSitesIdWithAtLeastViewAccess ( boolean $_restrictSitesToLogin = false ) : array | Returns the list of websites ID with the 'view' or 'admin' access for the current user. | |
getSitesIdWithViewAccess ( ) : array | Returns the list of websites ID with the 'view' access for the current user. | |
getSitesIdWithVisits ( boolean | integer $timestamp = false ) : array | Returns the list of the website IDs that received some visits since the specified timestamp. | |
getSitesWithAdminAccess ( boolean $fetchAliasUrls = false, false | string $pattern = false, false | integer $limit = false ) : array | Returns the list of websites with the 'admin' access for the current user. | |
getSitesWithAtLeastViewAccess ( boolean | integer $limit = false, boolean $_restrictSitesToLogin = false ) : array | Returns the list of websites with the 'view' or 'admin' access for the current user. | |
getSitesWithViewAccess ( ) : array | Returns the list of websites with the 'view' access for the current user. | |
getTimezonesList ( ) : array | Returns the list of timezones supported. | |
getUniqueSiteTimezones ( ) : array | Returns the list of unique timezones from all configured sites. | |
isSiteSpecificUserAgentExcludeEnabled ( ) : boolean | Returns true if site-specific user agent exclusion has been enabled. If it hasn't, only the global user agent substrings (see @setGlobalExcludedUserAgents) will be used. | |
isTimezoneSupportEnabled ( ) : boolean | Return true if Timezone support is enabled on server | |
renameGroup ( $oldGroupName, $newGroupName ) | ||
setDefaultCurrency ( string $defaultCurrency ) : boolean | Sets the default currency that will be used when creating websites | |
setDefaultTimezone ( string $defaultTimezone ) : boolean | Sets the default timezone that will be used when creating websites | |
setGlobalExcludedIps ( string $excludedIps ) : boolean | Sets IPs to be excluded from all websites. IPs can contain wildcards. | |
setGlobalExcludedQueryParameters ( string $excludedQueryParameters ) : boolean | Sets list of URL query parameters to be excluded on all websites. | |
setGlobalExcludedUserAgents ( string $excludedUserAgents ) | Sets list of user agent substrings to look for when excluding visits. For more info, | |
setGlobalSearchParameters ( $searchKeywordParameters, $searchCategoryParameters ) : boolean | Sets Site Search keyword/category parameter names, to be used on websites which have not specified these values Expects Comma separated list of query params names | |
setKeepURLFragmentsGlobal ( $enabled ) | Sets whether the default behavior should be to keep URL fragments when tracking or not. | |
setSiteAliasUrls ( $idSite, $urls = [] ) : integer | Set the list of alias Urls for the given idSite | |
setSiteSpecificUserAgentExcludeEnabled ( boolean $enabled ) | Sets whether it should be allowed to exclude different user agents for different websites. | |
updateSite ( integer $idSite, string $siteName = null, string | array $urls = null, integer $ecommerce = null, null | integer $siteSearch = null, string $searchKeywordParameters = null, string $searchCategoryParameters = null, string $excludedIps = null, null | string $excludedQueryParameters = null, string $timezone = null, string $currency = null, string $group = null, string $startDate = null, null | string $excludedUserAgents = null, integer | null $keepURLFragments = null, string $type = null, array | null $settingValues = null, boolean | null $excludeUnknownUrls = null ) : boolean | Update an existing website. | |
updateSiteCreatedTime ( $idSites, |
Updates the field ts_created for the specified websites. |
Method | Description | |
---|---|---|
getNormalizedUrls ( $url ) |
Method | Description | |
---|---|---|
checkAndReturnCommaSeparatedStringList ( $parameters ) | ||
checkAndReturnExcludedIps ( string $excludedIps ) : array | Checks that the submitted IPs (comma separated list) are valid Returns the cleaned up IPs | |
checkAndReturnType ( $type ) | ||
checkName ( $siteName ) | Check that the website name has a correct format. | |
checkValidCurrency ( $currency ) | ||
checkValidTimezone ( $timezone ) | ||
getModel ( ) | ||
getSitesFromIds ( array $idSites, boolean $limit = false ) : array | Returns the list of websites from the ID array in parameters. | |
getSitesId ( ) | ||
getTimezonesListUTCOffsets ( ) | ||
isValidIp ( string $ip ) : boolean | Tests if the IP is a valid IP, allowing wildcards, except in the first octet. | |
isValidUrl ( string $url ) : boolean | Tests if the URL is a valid URL | |
postUpdateWebsite ( $idSite ) | ||
removeTrailingSlash ( string $url ) : string | Remove the final slash in the URLs if found | |
saveMeasurableSettings ( $idSite, $idType, $settingValues ) | ||
setAndValidateMeasurableSettings ( $idSite, $idType, $settingValues ) | ||
setSettingValue ( $fieldName, $value, $settingValues ) |
public __construct ( |
||
$provider | ||
$settingsMetadata |
public addSite ( string $siteName, array | string $urls = null, integer $ecommerce = null, null $siteSearch = null, string $searchKeywordParameters = null, string $searchCategoryParameters = null, string $excludedIps = null, null $excludedQueryParameters = null, string $timezone = null, string $currency = null, string $group = null, string $startDate = null, null | string $excludedUserAgents = null, integer $keepURLFragments = null, string $type = null, array | null $settingValues = null, boolean | null $excludeUnknownUrls = null ) : integer | ||
$siteName | string | Site name |
$urls | array | string | The URLs array must contain at least one URL called the 'main_url' ; if several URLs are provided in the array, they will be recorded as Alias URLs for this website. When calling API via HTTP specify multiple URLs via `&urls[]=http...&urls[]=http...`. |
$ecommerce | integer | Is Ecommerce Reporting enabled for this website? |
$siteSearch | null | |
$searchKeywordParameters | string | Comma separated list of search keyword parameter names |
$searchCategoryParameters | string | Comma separated list of search category parameter names |
$excludedIps | string | Comma separated list of IPs to exclude from the reports (allows wildcards) |
$excludedQueryParameters | null | |
$timezone | string | Timezone string, eg. 'Europe/London' |
$currency | string | Currency, eg. 'EUR' |
$group | string | Website group identifier |
$startDate | string | Date at which the statistics for this website will start. Defaults to today's date in YYYY-MM-DD format |
$excludedUserAgents | null | string | |
$keepURLFragments | integer | If 1, URL fragments will be kept when tracking. If 2, they will be removed. If 0, the default global behavior will be used. |
$type | string | The website type, defaults to "website" if not set. |
$settingValues | array | null | JSON serialized settings eg {settingName: settingValue, ...} |
$excludeUnknownUrls | boolean | null | Track only URL matching one of website URLs |
return | integer | the website ID created |
public deleteSite ( integer $idSite ) | ||
$idSite | integer |
public getAllSites ( ) : array | ||
return | array | The list of websites, indexed by idsite |
public getAllSitesId ( ) : array | ||
return | array | The list of website IDs |
public getCurrencyList ( ) : array | ||
return | array | ( currencyId => currencyName) |
public getCurrencySymbols ( ) : array( | ||
return | array( |
public getDefaultCurrency ( ) : string | ||
return | string | Currency ID eg. 'USD' |
public getDefaultTimezone ( ) : string | ||
return | string | Timezone eg. UTC+7 or Europe/Paris |
public getExcludedIpsGlobal ( ) : string | ||
return | string | Comma separated list of IPs |
public getExcludedQueryParametersGlobal ( ) : string | ||
return | string | Comma separated list of URL parameters |
public getExcludedUserAgentsGlobal ( ) : string | ||
return | string | Comma separated list of strings. |
public getImageTrackingCode ( integer $idSite, string $piwikUrl = '', $actionName = false, integer $idGoal = false, integer $revenue = false ) : string | ||
$idSite | integer | The ID to generate tracking code for. |
$piwikUrl | string | The domain and URL path to the Piwik installation. |
$idGoal | integer | An ID for a goal to trigger a conversion for. |
$revenue | integer | The revenue of the goal conversion. Only used if $idGoal is supplied. |
return | string | The HTML tracking code. |
public getIpsForRange ( string $ipRange ) : array | false | ||
$ipRange | string | IP address range in presentation format |
return | array | false | Array( low, high ) IP addresses in presentation format; or false if error |
public getJavascriptTag ( integer $idSite, string $piwikUrl = '', boolean $mergeSubdomains = false, boolean $groupPageTitlesByDomain = false, boolean $mergeAliasUrls = false, boolean $visitorCustomVariables = false, boolean $pageCustomVariables = false, boolean $customCampaignNameQueryParam = false, boolean $customCampaignKeywordParam = false, boolean $doNotTrack = false, boolean $disableCookies = false, boolean $trackNoScript = false ) : string | ||
$idSite | integer | |
$piwikUrl | string | |
$mergeSubdomains | boolean | |
$groupPageTitlesByDomain | boolean | |
$mergeAliasUrls | boolean | |
$visitorCustomVariables | boolean | |
$pageCustomVariables | boolean | |
$customCampaignNameQueryParam | boolean | |
$customCampaignKeywordParam | boolean | |
$doNotTrack | boolean | |
$disableCookies | boolean | |
$trackNoScript | boolean | |
return | string | The Javascript tag ready to be included on the HTML pages |
public getKeepURLFragmentsGlobal ( ) : boolean | ||
return | boolean |
public getNumWebsitesToDisplayPerPage ( ) : integer | ||
return | integer |
public getSearchCategoryParametersGlobal ( ) : string | ||
return | string | Comma separated list of URL parameters |
public getSearchKeywordParametersGlobal ( ) : string | ||
return | string | Comma separated list of URL parameters |
public getSiteFromId ( integer $idSite ) : array | ||
$idSite | integer | |
return | array |
public getSiteUrlsFromId ( integer $idSite ) : array | ||
$idSite | integer | |
return | array | list of URLs |
public getSitesFromGroup ( string $group = '' ) : array | ||
$group | string | Group name |
return | array | of sites |
public getSitesGroups ( ) : array | ||
return | array | of group names strings |
public getSitesIdFromSiteUrl ( string $url ) : array | ||
$url | string | |
return | array | list of websites ID |
public getSitesIdFromTimezones ( array $timezones ) : array | ||
$timezones | array | |
return | array |
public getSitesIdWithAdminAccess ( ) : array | ||
return | array | list of websites ID |
public getSitesIdWithAtLeastViewAccess ( boolean $_restrictSitesToLogin = false ) : array | ||
$_restrictSitesToLogin | boolean | |
return | array | list of websites ID |
public getSitesIdWithViewAccess ( ) : array | ||
return | array | list of websites ID |
public getSitesWithAtLeastViewAccess ( boolean | integer $limit = false, boolean $_restrictSitesToLogin = false ) : array | ||
$limit | boolean | integer | Specify max number of sites to return |
$_restrictSitesToLogin | boolean | Hack necessary when running scheduled tasks, where "Super User" is forced, but sometimes not desired, see #3017 |
return | array | array for each site, an array of information (idsite, name, main_url, etc.) |
public getSitesWithViewAccess ( ) : array | ||
return | array | for each site, an array of information (idsite, name, main_url, etc.) |
public getTimezonesList ( ) : array | ||
return | array | of timezone strings |
public getUniqueSiteTimezones ( ) : array | ||
return | array | ( string ) |
public isSiteSpecificUserAgentExcludeEnabled ( ) : boolean | ||
return | boolean |
public isTimezoneSupportEnabled ( ) : boolean | ||
return | boolean |
public setDefaultCurrency ( string $defaultCurrency ) : boolean | ||
$defaultCurrency | string | Currency code, eg. 'USD' |
return | boolean |
public setDefaultTimezone ( string $defaultTimezone ) : boolean | ||
$defaultTimezone | string | Timezone string eg. Europe/Paris or UTC+8 |
return | boolean |
public setGlobalExcludedIps ( string $excludedIps ) : boolean | ||
$excludedIps | string | Comma separated list of IPs to exclude from being tracked (allows wildcards) |
return | boolean |
public setGlobalExcludedQueryParameters ( string $excludedQueryParameters ) : boolean | ||
$excludedQueryParameters | string | Comma separated list of URL query parameters to exclude from URLs |
return | boolean |
public setGlobalExcludedUserAgents ( string $excludedUserAgents ) | ||
$excludedUserAgents | string | Comma separated list of strings. Each element is trimmed, and empty strings are removed. |
public setGlobalSearchParameters ( $searchKeywordParameters, $searchCategoryParameters ) : boolean | ||
return | boolean |
public setKeepURLFragmentsGlobal ( $enabled ) | ||
$enabled | bool If true, the default behavior will be to keep URL fragments when tracking. If false, the default behavior will be to remove them. |
public setSiteAliasUrls ( $idSite, $urls = [] ) : integer | ||
return | integer | the number of inserted URLs |
public setSiteSpecificUserAgentExcludeEnabled ( boolean $enabled ) | ||
$enabled | boolean |
public updateSite ( integer $idSite, string $siteName = null, string | array $urls = null, integer $ecommerce = null, null | integer $siteSearch = null, string $searchKeywordParameters = null, string $searchCategoryParameters = null, string $excludedIps = null, null | string $excludedQueryParameters = null, string $timezone = null, string $currency = null, string $group = null, string $startDate = null, null | string $excludedUserAgents = null, integer | null $keepURLFragments = null, string $type = null, array | null $settingValues = null, boolean | null $excludeUnknownUrls = null ) : boolean | ||
$idSite | integer | website ID defining the website to edit |
$siteName | string | website name |
$urls | string | array | the website URLs When calling API via HTTP specify multiple URLs via `&urls[]=http...&urls[]=http...`. |
$ecommerce | integer | Whether Ecommerce is enabled, 0 or 1 |
$siteSearch | null | integer | Whether site search is enabled, 0 or 1 |
$searchKeywordParameters | string | Comma separated list of search keyword parameter names |
$searchCategoryParameters | string | Comma separated list of search category parameter names |
$excludedIps | string | Comma separated list of IPs to exclude from being tracked (allows wildcards) |
$excludedQueryParameters | null | string | |
$timezone | string | Timezone |
$currency | string | Currency code |
$group | string | Group name where this website belongs |
$startDate | string | Date at which the statistics for this website will start. Defaults to today's date in YYYY-MM-DD format |
$excludedUserAgents | null | string | |
$keepURLFragments | integer | null | If 1, URL fragments will be kept when tracking. If 2, they will be removed. If 0, the default global behavior will be used. |
$type | string | The Website type, default value is "website" |
$settingValues | array | null | JSON serialized settings eg {settingName: settingValue, ...} |
$excludeUnknownUrls | boolean | null | Track only URL matching one of website URLs |
return | boolean | true on success |
public updateSiteCreatedTime ( $idSites, |
||
$idSites | int Id Site to update ts_created | |
$minDate | Date to set as creation date. To play it safe it will subtract one more day. |