PHP Class Piwik\Plugins\Referrers\API

For example, "getKeywords" returns all search engine keywords (with general analytics metrics for each keyword), "getWebsites" returns referrer websites (along with the full Referrer URL if the parameter &expanded=1 is set). "getReferrerType" returns the Referrer overview report. "getCampaigns" returns the list of all campaigns (and all campaign keywords if the parameter &expanded=1 is set). The methods "getKeywordsForPageUrl" and "getKeywordsForPageTitle" are used to output the top keywords used to find a page. Check out the widget "Top keywords used to find this page" that you can easily re-use on your website.
Inheritance: extends Piwik\Plugin\API
Show file Open project: piwik/piwik Class Usage Examples

Public Methods

Method Description
getAll ( $idSite, $period, $date, $segment = false ) Returns a report that shows
getCampaigns ( $idSite, $period, $date, $segment = false, $expanded = false )
getCleanKeyword ( $label )
getKeywordNotDefinedString ( )
getKeywords ( $idSite, $period, $date, $segment = false, $expanded = false, $flat = false )
getKeywordsForPageTitle ( $idSite, $period, $date, $title )
getKeywordsForPageUrl ( $idSite, $period, $date, $url )
getKeywordsFromCampaignId ( $idSite, $period, $date, $idSubtable, $segment = false )
getKeywordsFromSearchEngineId ( $idSite, $period, $date, $idSubtable, $segment = false )
getNumberOfDistinctCampaigns ( $idSite, $period, $date, $segment = false )
getNumberOfDistinctKeywords ( $idSite, $period, $date, $segment = false )
getNumberOfDistinctSearchEngines ( $idSite, $period, $date, $segment = false )
getNumberOfDistinctWebsites ( $idSite, $period, $date, $segment = false )
getNumberOfDistinctWebsitesUrls ( $idSite, $period, $date, $segment = false )
getReferrerType ( string $idSite, string $period, string $date, boolean | string $segment = false, boolean | integer $typeReferrer = false, boolean | integer $idSubtable = false, boolean $expanded = false ) : DataTable Returns a report describing visit information for each possible referrer type. The result is a datatable whose subtables are the reports for each parent row's referrer type.
getSearchEngines ( $idSite, $period, $date, $segment = false, $expanded = false, $flat = false )
getSearchEnginesFromKeywordId ( $idSite, $period, $date, $idSubtable, $segment = false )
getSocials ( string $idSite, string $period, string $date, string | boolean $segment = false, boolean $expanded = false, boolean $flat = false ) : DataTable Returns report comparing the number of visits (and other info) for social network referrers.
getUrlsForSocial ( string $idSite, string $period, string $date, boolean | string $segment = false, boolean | integer $idSubtable = false ) : DataTable Returns report containing individual referrer URLs for a specific social networking site.
getUrlsFromWebsiteId ( $idSite, $period, $date, $idSubtable, $segment = false )
getWebsites ( $idSite, $period, $date, $segment = false, $expanded = false, $flat = false )

Protected Methods

Method Description
getDataTable ( string $name, integer $idSite, string $period, string | Date $date, string $segment, boolean $expanded = false, integer | null $idSubtable = null ) : DataTable
getLabelsFromTable ( $table )

Private Methods

Method Description
buildExpandedTableForFlattenGetSocials ( integer $idSite, string $period, string $date, string | false $segment, boolean $expanded, DataTable $dataTable )
filterOutKeywordNotDefined ( DataTable $table )
getNumeric ( $name, $idSite, $period, $date, $segment )
removeSubtableIds ( DataTable $table ) : DataTable Utility function that removes the subtable IDs for the subtables of the getReferrerType report. This avoids infinite recursion in said report (ie, the grandchildren of the report will be the original report, and it will recurse when trying to get a flat report).
removeSubtableMetadata ( DataTable $dataTable ) Removes idsubdatatable_in_db metadata from a DataTable. Used by Social tables since they use fake subtable IDs.
setSocialIdSubtables ( DataTable $dataTable ) Sets the subtable IDs for the DataTable returned by getSocial.

Method Details

getAll() public method

Returns a report that shows
public getAll ( $idSite, $period, $date, $segment = false )

getCampaigns() public method

public getCampaigns ( $idSite, $period, $date, $segment = false, $expanded = false )

getCleanKeyword() public static method

public static getCleanKeyword ( $label )

getDataTable() protected method

protected getDataTable ( string $name, integer $idSite, string $period, string | Date $date, string $segment, boolean $expanded = false, integer | null $idSubtable = null ) : DataTable
$name string
$idSite integer
$period string
$date string | Piwik\Date
$segment string
$expanded boolean
$idSubtable integer | null
return Piwik\DataTable

getKeywordNotDefinedString() public static method

public static getKeywordNotDefinedString ( )

getKeywords() public method

public getKeywords ( $idSite, $period, $date, $segment = false, $expanded = false, $flat = false )

getKeywordsForPageTitle() public method

public getKeywordsForPageTitle ( $idSite, $period, $date, $title )

getKeywordsForPageUrl() public method

public getKeywordsForPageUrl ( $idSite, $period, $date, $url )

getKeywordsFromCampaignId() public method

public getKeywordsFromCampaignId ( $idSite, $period, $date, $idSubtable, $segment = false )

getKeywordsFromSearchEngineId() public method

public getKeywordsFromSearchEngineId ( $idSite, $period, $date, $idSubtable, $segment = false )

getLabelsFromTable() protected method

protected getLabelsFromTable ( $table )

getNumberOfDistinctCampaigns() public method

public getNumberOfDistinctCampaigns ( $idSite, $period, $date, $segment = false )

getNumberOfDistinctKeywords() public method

public getNumberOfDistinctKeywords ( $idSite, $period, $date, $segment = false )

getNumberOfDistinctSearchEngines() public method

public getNumberOfDistinctSearchEngines ( $idSite, $period, $date, $segment = false )

getNumberOfDistinctWebsites() public method

public getNumberOfDistinctWebsites ( $idSite, $period, $date, $segment = false )

getNumberOfDistinctWebsitesUrls() public method

public getNumberOfDistinctWebsitesUrls ( $idSite, $period, $date, $segment = false )

getReferrerType() public method

The subtable reports are: 'getKeywords' (for search engine referrer type), 'getWebsites', and 'getCampaigns'.
public getReferrerType ( string $idSite, string $period, string $date, boolean | string $segment = false, boolean | integer $typeReferrer = false, boolean | integer $idSubtable = false, boolean $expanded = false ) : DataTable
$idSite string The site ID.
$period string The period to get data for, either 'day', 'week', 'month', 'year', or 'range'.
$date string The date of the period.
$segment boolean | string The segment to use.
$typeReferrer boolean | integer (deprecated) If you want to get data only for a specific referrer type, supply a type for this parameter.
$idSubtable boolean | integer For this report this value is a referrer type ID and not an actual subtable ID. The result when using this parameter will be the specific report for the given referrer type.
$expanded boolean Whether to get report w/ subtables loaded or not.
return Piwik\DataTable

getSearchEngines() public method

public getSearchEngines ( $idSite, $period, $date, $segment = false, $expanded = false, $flat = false )

getSearchEnginesFromKeywordId() public method

public getSearchEnginesFromKeywordId ( $idSite, $period, $date, $idSubtable, $segment = false )

getSocials() public method

This is a view of the getWebsites report.
public getSocials ( string $idSite, string $period, string $date, string | boolean $segment = false, boolean $expanded = false, boolean $flat = false ) : DataTable
$idSite string
$period string
$date string
$segment string | boolean
$expanded boolean
$flat boolean
return Piwik\DataTable

getUrlsForSocial() public method

Returns report containing individual referrer URLs for a specific social networking site.
public getUrlsForSocial ( string $idSite, string $period, string $date, boolean | string $segment = false, boolean | integer $idSubtable = false ) : DataTable
$idSite string
$period string
$date string
$segment boolean | string
$idSubtable boolean | integer This ID does not reference a real DataTable record. Instead, it is the array index of an item in the Socials list file. The urls are filtered by the social network at this index. If false, no filtering is done and every social URL is returned.
return Piwik\DataTable

getUrlsFromWebsiteId() public method

public getUrlsFromWebsiteId ( $idSite, $period, $date, $idSubtable, $segment = false )

getWebsites() public method

public getWebsites ( $idSite, $period, $date, $segment = false, $expanded = false, $flat = false )