diff --git a/README.md b/README.md index ecdace7..6235bee 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,47 @@ -# Very short description of the package +

+ Hero +

-[![Latest Version on Packagist](https://img.shields.io/packagist/v/akki-io/laravel-google-analytics.svg?style=flat-square)](https://packagist.org/packages/akki-io/laravel-google-analytics) -[![Total Downloads](https://img.shields.io/packagist/dt/akki-io/laravel-google-analytics.svg?style=flat-square)](https://packagist.org/packages/akki-io/laravel-google-analytics) -![GitHub Actions](https://github.com/akki-io/laravel-google-analytics/actions/workflows/main.yml/badge.svg) +# Laravel Google Analytics -This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors. +[![Latest Version](https://img.shields.io/github/release/akki-io/laravel-google-analytics.svg?style=flat-square)](https://github.com/akki-io/laravel-google-analytics/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) +[![StyleCI](https://styleci.io/repos/441735142/shield?branch=master)](https://styleci.io/repos/441735142) +[![Total Downloads](https://img.shields.io/packagist/dt/akki-io/laravel-google-analytics.svg?style=flat-square)](https://packagist.org/packages/akki-io/laravel-google-analytics) -## Installation +A Laravel package to retrieve data from Google Analytics 4 using the GA4 Query Explorer -You can install the package via composer: +## TL;DR -```bash -composer require akki-io/laravel-google-analytics -``` +Using this package you can easily retrieve data from Google Analytics 4. -## Usage +Below are some examples. ```php -// Usage description here -``` -### Testing - -```bash -composer test +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; + +// get the top 20 viewed pages for last 30 days +LaravelGoogleAnalytics::getTopViewedPages(Period::days(30), $count = 20); + +// 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(); ``` -### Changelog -Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. +Please refer to the [wiki]((https://github.com/akki-io/laravel-google-analytics/wiki)) for more details. + ## Contributing @@ -40,13 +53,9 @@ If you discover any security related issues, please email hello@akki.io instead ## Credits -- [Akki Khare](https://github.com/akki-io) -- [All Contributors](../../contributors) +- [Akki Khare](https://github.com/akki-io) +- [All Contributors](../../contributors) ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information. - -## Laravel Package Boilerplate - -This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com). diff --git a/composer.json b/composer.json index 58e5935..b2da21a 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "AkkiIo\\LaravelGoogleAnalytics\\LaravelGoogleAnalyticsServiceProvider" ], "aliases": { - "LaravelGoogleAnalytics": "AkkiIo\\LaravelGoogleAnalytics\\Facade\\LaravelGoogleAnalytics" + "LaravelGoogleAnalytics": "AkkiIo\\LaravelGoogleAnalytics\\Facades\\LaravelGoogleAnalytics" } } } diff --git a/images/add-user.jpg b/images/add-user.jpg new file mode 100644 index 0000000..fee30af Binary files /dev/null and b/images/add-user.jpg differ diff --git a/images/copy-property-id.jpg b/images/copy-property-id.jpg new file mode 100644 index 0000000..b8ca84c Binary files /dev/null and b/images/copy-property-id.jpg differ diff --git a/images/create-new-json-key.jpg b/images/create-new-json-key.jpg new file mode 100644 index 0000000..922e634 Binary files /dev/null and b/images/create-new-json-key.jpg differ diff --git a/images/create-service-account.jpg b/images/create-service-account.jpg new file mode 100644 index 0000000..053a5a3 Binary files /dev/null and b/images/create-service-account.jpg differ diff --git a/images/enable-api.jpg b/images/enable-api.jpg new file mode 100644 index 0000000..67226f8 Binary files /dev/null and b/images/enable-api.jpg differ diff --git a/images/get-account-id.jpg b/images/get-account-id.jpg new file mode 100644 index 0000000..4472e82 Binary files /dev/null and b/images/get-account-id.jpg differ diff --git a/images/hero.png b/images/hero.png new file mode 100644 index 0000000..e6a9f03 Binary files /dev/null and b/images/hero.png differ diff --git a/images/select-account-access-management.jpg b/images/select-account-access-management.jpg new file mode 100644 index 0000000..5130afa Binary files /dev/null and b/images/select-account-access-management.jpg differ diff --git a/images/select-add-user.jpg b/images/select-add-user.jpg new file mode 100644 index 0000000..bfd77d9 Binary files /dev/null and b/images/select-add-user.jpg differ diff --git a/images/select-api.jpg b/images/select-api.jpg new file mode 100644 index 0000000..dded0cb Binary files /dev/null and b/images/select-api.jpg differ diff --git a/images/select-create-a-new-key.jpg b/images/select-create-a-new-key.jpg new file mode 100644 index 0000000..e109255 Binary files /dev/null and b/images/select-create-a-new-key.jpg differ diff --git a/images/select-create-service-account.jpg b/images/select-create-service-account.jpg new file mode 100644 index 0000000..8c43968 Binary files /dev/null and b/images/select-create-service-account.jpg differ diff --git a/images/select-credentials.jpg b/images/select-credentials.jpg new file mode 100644 index 0000000..c112092 Binary files /dev/null and b/images/select-credentials.jpg differ diff --git a/images/select-google-analytics-account-and-select-admin.jpg b/images/select-google-analytics-account-and-select-admin.jpg new file mode 100644 index 0000000..c8c7c9e Binary files /dev/null and b/images/select-google-analytics-account-and-select-admin.jpg differ diff --git a/images/select-manage-keys.jpg b/images/select-manage-keys.jpg new file mode 100644 index 0000000..01e7d6b Binary files /dev/null and b/images/select-manage-keys.jpg differ diff --git a/images/select-manage-service-account.jpg b/images/select-manage-service-account.jpg new file mode 100644 index 0000000..d45e6cc Binary files /dev/null and b/images/select-manage-service-account.jpg differ diff --git a/images/select-project.jpg b/images/select-project.jpg new file mode 100644 index 0000000..c74bb74 Binary files /dev/null and b/images/select-project.jpg differ diff --git a/images/select-property-settings.jpg b/images/select-property-settings.jpg new file mode 100644 index 0000000..edf175d Binary files /dev/null and b/images/select-property-settings.jpg differ