pugofka / yametrika-sdk-laravel
Laravel package for Yandex Metrika SDK
0.2.0
2021-02-16 19:17 UTC
Requires
- php: ^7.1.3
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- nesbot/carbon: ^2.45
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- orchestra/testbench: ^5.0
- phpunit/phpunit: ^9.0
- psalm/plugin-laravel: ^1.2
- vimeo/psalm: ^3.11
This package is auto-updated.
Last update: 2024-10-15 16:42:50 UTC
README
This is not offical package. Can work with static configuration for one project and with dynamically configuration at runtime for SAAS.
Usage
- Create new app link
- Set app_id to config
- use getAuthTokenLink() for for auth link. Docs for work with Yandex Oauth. Set token for static resource or use this example for set it for dinamyc resources:
use Pugofka\Yametrika\YametrikaClient; class AwesomeClass { public function setToken(YametrikaClient $client) { $client->setToken('your_token'); } }
YametrikaClient class is singleton.
Counters
YametrikaCounters class response for work with counters. getCounters() method return array of counters
Reports
Before use Reports, you should set app_id, token and counter_id.
Ecom report
Get data for ecom reports.
$ecomReport = resolve(\Pugofka\Yametrika\YametrikaEcomReports::class); $ecomData = $ecomReport->getEcomData(\Carbon\Carbon::today()->subYears(1), \Carbon\Carbon::today(), $limit = 500, $offset = 1); $ecomSources = $ecomReport->getEcomSourcesReport(\Carbon\Carbon::today()->subWeek(), \Carbon\Carbon::today(), $limit = 500, $offset = 1);