PHP Class Spatie\Analytics\Analytics

Show file Open project: spatie/laravel-analytics

Protected Properties

Property Type Description
$client AnalyticsClient
$viewId string

Public Methods

Method Description
__construct ( AnalyticsClient $client, string $viewId )
fetchMostVisitedPages ( Period $period, integer $maxResults = 20 ) : Collection
fetchTopBrowsers ( Period $period, integer $maxResults = 10 ) : Collection
fetchTopReferrers ( Period $period, integer $maxResults = 20 ) : Collection
fetchTotalVisitorsAndPageViews ( Period $period ) : Collection
fetchVisitorsAndPageViews ( Period $period ) : Collection
getAnalyticsService ( ) : Google_Service_Analytic\Google_Service_Analytics Get the underlying Google_Service_Analytics object. You can use this to basically call anything on the Google Analytics API.
performQuery ( Period $period, string $metrics, array $others = [] ) : array | null Call the query method on the authenticated client.
setViewId ( string $viewId )

Protected Methods

Method Description
summarizeTopBrowsers ( Collection $topBrowsers, integer $maxResults ) : Collection

Method Details

__construct() public method

public __construct ( AnalyticsClient $client, string $viewId )
$client AnalyticsClient
$viewId string

fetchMostVisitedPages() public method

public fetchMostVisitedPages ( Period $period, integer $maxResults = 20 ) : Collection
$period Period
$maxResults integer
return Illuminate\Support\Collection

fetchTopBrowsers() public method

public fetchTopBrowsers ( Period $period, integer $maxResults = 10 ) : Collection
$period Period
$maxResults integer
return Illuminate\Support\Collection

fetchTopReferrers() public method

public fetchTopReferrers ( Period $period, integer $maxResults = 20 ) : Collection
$period Period
$maxResults integer
return Illuminate\Support\Collection

fetchTotalVisitorsAndPageViews() public method

public fetchTotalVisitorsAndPageViews ( Period $period ) : Collection
$period Period
return Illuminate\Support\Collection

fetchVisitorsAndPageViews() public method

public fetchVisitorsAndPageViews ( Period $period ) : Collection
$period Period
return Illuminate\Support\Collection

getAnalyticsService() public method

Get the underlying Google_Service_Analytics object. You can use this to basically call anything on the Google Analytics API.
public getAnalyticsService ( ) : Google_Service_Analytic\Google_Service_Analytics
return Google_Service_Analytic\Google_Service_Analytics

performQuery() public method

Call the query method on the authenticated client.
public performQuery ( Period $period, string $metrics, array $others = [] ) : array | null
$period Period
$metrics string
$others array
return array | null

setViewId() public method

public setViewId ( string $viewId )
$viewId string

summarizeTopBrowsers() protected method

protected summarizeTopBrowsers ( Collection $topBrowsers, integer $maxResults ) : Collection
$topBrowsers Illuminate\Support\Collection
$maxResults integer
return Illuminate\Support\Collection

Property Details

$client protected property

protected AnalyticsClient,Spatie\Analytics $client
return AnalyticsClient

$viewId protected property

protected string $viewId
return string