diff --git a/app/library/App/Bootstrap/CollectionBootstrap.php b/app/library/App/Bootstrap/CollectionBootstrap.php index 11632cd..0f948a2 100755 --- a/app/library/App/Bootstrap/CollectionBootstrap.php +++ b/app/library/App/Bootstrap/CollectionBootstrap.php @@ -21,6 +21,7 @@ class CollectionBootstrap implements BootstrapInterface ->resource(new UserResource('/users')) ->resource(new AlbumResource('/albums')) ->resource(new PhotoResource('/photos')) - ->resource(new ProjectResource('/projects')); + ->resource(new ProjectResource('/projects')) + ->resource(new ProjectResource('/ga')); } } diff --git a/app/library/App/Bootstrap/RouteBootstrap.php b/app/library/App/Bootstrap/RouteBootstrap.php index 7c49fb0..3fda244 100755 --- a/app/library/App/Bootstrap/RouteBootstrap.php +++ b/app/library/App/Bootstrap/RouteBootstrap.php @@ -7,6 +7,7 @@ use App\Constants\Services; use Phalcon\Config; use Phalcon\DiInterface; use PhalconRest\Api; + use Google_Client; use Google_Service_AnalyticsReporting; use Google_Service_AnalyticsReporting_DateRange; @@ -19,7 +20,6 @@ use Google_Service_AnalyticsReporting_GetReportsRequest; class RouteBootstrap implements BootstrapInterface { - public $VIEW_ID = '123'; public function run(Api $api, DiInterface $di, Config $config) { @@ -66,8 +66,8 @@ class RouteBootstrap implements BootstrapInterface $param[] = ['metric' => 'ga:sessions', 'alias' => 'Сессии']; $param[] = ['metric' => 'ga:users', 'alias' => 'Пользователи']; - $param[] = ['metric' => 'ga:CTR', 'alias' => 'CTR']; - $param[] = ['metric' => 'ga:goal1Value', 'alias' => 'цель "Корзина"']; + //$param[] = ['metric' => 'ga:CTR', 'alias' => 'CTR']; + //$param[] = ['metric' => 'ga:goal1Value', 'alias' => 'цель "Корзина"']; $VIEW_ID = "119240817"; diff --git a/app/library/App/Controllers/GaController.php b/app/library/App/Controllers/GaController.php new file mode 100644 index 0000000..5141f34 --- /dev/null +++ b/app/library/App/Controllers/GaController.php @@ -0,0 +1,22 @@ +name('Google Analytics') + //->model(Project::class) + ->expectsJsonData() + //->transformer(ModelTransformer::class) + ->itemKey('ga') + ->collectionKey('ga') + ->deny(AclRoles::UNAUTHORIZED) + ->handler(GaController::class) + + ->endpoint(ApiEndpoint::get('/', 'gaRequest') + ->allow(AclRoles::USER) + ->description('Returns data from Google Analytics Api') + ) + ; + + } + +} \ No newline at end of file -- libgit2 0.21.4