{"id":17343402,"url":"https://github.com/firesphere/silverstripe-google-api","last_synced_at":"2025-04-14T19:53:57.724Z","repository":{"id":62504948,"uuid":"107493082","full_name":"Firesphere/silverstripe-google-api","owner":"Firesphere","description":"Get page visits from the Google Analytics API to show popular pages on your site","archived":false,"fork":false,"pushed_at":"2019-09-22T06:21:31.000Z","size":49,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T08:12:12.937Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Firesphere.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-19T03:20:31.000Z","updated_at":"2023-01-16T01:11:06.000Z","dependencies_parsed_at":"2022-11-02T10:01:28.181Z","dependency_job_id":null,"html_url":"https://github.com/Firesphere/silverstripe-google-api","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firesphere%2Fsilverstripe-google-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firesphere%2Fsilverstripe-google-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firesphere%2Fsilverstripe-google-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firesphere%2Fsilverstripe-google-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Firesphere","download_url":"https://codeload.github.com/Firesphere/silverstripe-google-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248952035,"owners_count":21188421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-10-15T16:09:16.890Z","updated_at":"2025-04-14T19:53:57.680Z","avatar_url":"https://github.com/Firesphere.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Connect to Google API\n[![codecov](https://codecov.io/gh/Firesphere/silverstripe-google-api/branch/master/graph/badge.svg)](https://codecov.io/gh/Firesphere/silverstripe-google-api)\n[![Scrutinizer](https://scrutinizer-ci.com/g/Firesphere/silverstripe-google-api/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Firesphere/silverstripe-google-api/)\n[![CircleCI](https://circleci.com/gh/Firesphere/silverstripe-google-api/tree/master.svg?style=svg)](https://circleci.com/gh/Firesphere/silverstripe-google-api/tree/master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/893fcc84d65664ec64c9/maintainability)](https://codeclimate.com/github/Firesphere/silverstripe-google-api/maintainability)\n\n## Google API\nThe Google API V4 is pretty powerful and supports many different calls to different applications.\n\nThe initial use case implemented in this module is, to get the page views for the a set of pages in a given time period and store this count in the database, so that you can sort pages by popularity.\nThere are many features of the google api, that could be included in future updates or extensions of this module.\n\nFurther functionality is possible with the given API\n\n## Installation\n\n`composer require firesphere/google-api:dev-master`\n\nAnd run a `dev/build`\n\n## Set up\n\nFirst, you will have to set up a Google API application, that is connected to Google Analytics.\nHow to set that up is detailed [In the Google Documentation](https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-php).\n\nAdd the absolute path to the key to your `_ss_environment` file:\n```php\ndefine('SS_ANALYTICS_KEY', 'name-of-my-file');\n```\n\nCurrently, the OAuth2 integration is not built yet, so for now, add the email address from the downloaded json (key: client_email)\nand add this user to your Analytics account. You will need to give it full administrative powers.\n\nSecond, copy your `View ID` from the Google Analytics account you want your data from, and put it in the cms under Settings \u003e Google API\n\n## Configuration\n\nCreate a yml file, or add to an existing config yml the configuration for your update:\n```yaml\nGoogleAnalyticsReportService:\n  begins_with: '/mypage' # Find everything Google knows about children of this page. Can not be used in combination with other configurations\n  ends_with: 'mypage' # Find everything Google knows about pages whose URL end with 'mypage', Can not be used in combination with other configurations\n  whitelist: # Array of pagetypes you want to search for. Can be combined with blacklist\n    - MyPageType\n    - MyOtherPageType\n  blacklist: # Exclude these pagetypes from being returned\n    - MyBlacklistedPage\n    - MyOtherBlacklistedPage\n```\n\nWith multiple filters, it seems Google limits to only the first 20 filters.\n\nIf you have multiple filters, you need to set up the batch functionality. By default, the CronTask will do this for you.\n\nThe crontask currently does _not_ support scheduling, but will probably do so in the future.\n\nFilters are what Google calls \"DimensionFilters\", which are contained in a \"DimensionFilterClause\". A filter, at this stage, is a specific page URL.\n\nMore on [DimensionFilterClauses and DimensionFilters can be found in the Google Documentation](https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet#DimensionFilterClause).\n\n## Did you say Ninja Unicorns?\n\n```\n                                                    /\n                                                  .7\n                                       \\       , //\n                                       |\\.--._/|//\n                                      /\\ ) ) ).'/\n                                     /(  \\  // /\n                                    /(   J`((_/ \\\n                                   / ) | _\\     /\n                                  /|)  \\  eJ    L\n                                 |  \\ L \\   L   L\n                                /  \\  J  `. J   L\n                                |  )   L   \\/   \\\n                               /  \\    J   (\\   /\n             _....___         |  \\      \\   \\```\n      ,.._.-'        '''--...-||\\     -. \\   \\\n    .'.=.'                    `         `.\\ [ Y\n   /   /                                  \\]  J\n  Y / Y                                    Y   L\n  | | |          \\                         |   L\n  | | |           Y                        A  J\n  |   I           |                       /I\\ /\n  |    \\          I             \\        ( |]/|\n  J     \\         /._           /        -tI/ |\n   L     )       /   /'-------'J           `'-:.\n   J   .'      ,'  ,' ,     \\   `'-.__          \\\n    \\ T      ,'  ,'   )\\    /|        ';'---7   /\n     \\|    ,'L  Y...-' / _.' /         \\   /   /\n      J   Y  |  J    .'-'   /         ,--.(   /\n       L  |  J   L -'     .'         /  |    /\\\n       |  J.  L  J     .-;.-/       |    \\ .' /\n       J   L`-J   L____,.-'`        |  _.-'   |\n        L  J   L  J                  ``  J    |\n        J   L  |   L                     J    |\n         L  J  L    \\                    L    \\\n         |   L  ) _.'\\                    ) _.'\\\n         L    \\('`    \\                  ('`    \\\n          ) _.'\\`-....'                   `-....'\n         ('`    \\\n          `-.___/ \n```\n\n## License\n\nBSD-3 clause","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiresphere%2Fsilverstripe-google-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiresphere%2Fsilverstripe-google-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiresphere%2Fsilverstripe-google-api/lists"}