-
Notifications
You must be signed in to change notification settings - Fork 21
3. Usage
Akki Khare edited this page Jan 16, 2023
·
3 revisions
use AkkiIo\LaravelGoogleAnalytics\Facades\LaravelGoogleAnalytics;
use AkkiIo\LaravelGoogleAnalytics\Period;
use Google\Analytics\Data\V1beta\Filter\StringFilter\MatchType;
use Google\Analytics\Data\V1beta\MetricAggregation;
use Google\Analytics\Data\V1beta\Filter\NumericFilter\Operation;
// build a query using the `get()` method
LaravelGoogleAnalytics::dateRanges(Period::days(30), Period::days(60))
->metrics('active1DayUsers', 'active7DayUsers')
->dimensions('browser', 'language')
->metricAggregations(MetricAggregation::TOTAL, MetricAggregation::MINIMUM)
->whereDimension('browser', MatchType::CONTAINS, 'firefox')
->whereMetric('active7DayUsers', Operation::GREATER_THAN, 50)
->orderByDimensionDesc('language')
->get();
@method static self setPropertyId( $propertyId = NULL)
@method static self setCredentials( $credentials = NULL)
@method static \Google\Analytics\Data\V1beta\BetaAnalyticsDataClient getClient()
@method static self dateRange(\AkkiIo\LaravelGoogleAnalytics\Period $period)
@method static self dateRanges(\AkkiIo\LaravelGoogleAnalytics\Period ...$items)
@method static self metric(string $name)
@method static self metrics(string ...$items)
@method static self dimension(string $name)
@method static self dimensions(string ...$items)
@method static self orderByMetric(string $name, string $order = 'ASC')
@method static self orderByMetricDesc(string $name)
@method static self orderByDimension(string $name, string $order = 'ASC')
@method static self orderByDimensionDesc(string $name)
@method static self metricAggregation(int $value)
@method static self metricAggregations(int ...$items)
@method static self whereDimension(string $name, int $matchType, $value, bool $caseSensitive = false)
@method static self whereDimensionIn(string $name, array $values, bool $caseSensitive = false)
@method static self whereAndGroupDimensions($dimensions)
@method static self whereOrGroupDimensions($dimensions)
@method static self whereMetric(string $name, int $operation, $value)
@method static self whereMetricBetween(string $name, $from, $to)
@method static self keepEmptyRows(bool $keepEmptyRows = false)
@method static self limit(?int $limit = NULL)
@method static self offset(?int $offset = NULL)
@method static \AkkiIo\LaravelGoogleAnalytics\LaravelGoogleAnalyticsResponse get()