{"id":16252386,"url":"https://github.com/remarkablemark/googleapis-analytics-demo","last_synced_at":"2026-04-21T10:04:31.772Z","repository":{"id":66056475,"uuid":"367775876","full_name":"remarkablemark/googleapis-analytics-demo","owner":"remarkablemark","description":"Demo of the Google Analytics API.","archived":false,"fork":false,"pushed_at":"2021-05-16T23:59:15.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T12:50:21.258Z","etag":null,"topics":["analytics","google","google-analytics","google-analytics-api","googleapis","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remarkablemark.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["remarkablemark"],"patreon":"remarkablemark","open_collective":null,"ko_fi":"remarkablemark","tidelift":null,"community_bridge":null,"liberapay":"remarkablemark","issuehunt":null,"otechie":null,"thanks_dev":"u/gh/remarkablemark","custom":["https://b.remarkabl.org/teespring"]}},"created_at":"2021-05-16T03:21:56.000Z","updated_at":"2021-05-16T23:59:17.000Z","dependencies_parsed_at":"2023-03-13T20:30:59.009Z","dependency_job_id":null,"html_url":"https://github.com/remarkablemark/googleapis-analytics-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/remarkablemark/googleapis-analytics-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fgoogleapis-analytics-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fgoogleapis-analytics-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fgoogleapis-analytics-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fgoogleapis-analytics-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remarkablemark","download_url":"https://codeload.github.com/remarkablemark/googleapis-analytics-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fgoogleapis-analytics-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273862212,"owners_count":25181520,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["analytics","google","google-analytics","google-analytics-api","googleapis","javascript","nodejs"],"created_at":"2024-10-10T15:13:31.196Z","updated_at":"2025-10-31T07:37:33.032Z","avatar_url":"https://github.com/remarkablemark.png","language":"JavaScript","readme":"# googleapis-analytics-demo\n\n![GitHub last commit](https://img.shields.io/github/last-commit/remarkablemark/googleapis-analytics-demo)\n\nDemo of the [Google Analytics API](https://www.npmjs.com/package/@googleapis/analytics).\n\n## Prerequisites\n\n- [Node.js](https://nodejs.org/)\n- [npm](https://www.npmjs.com/get-npm)\n\n## Install\n\nClone the repository:\n\n```sh\ngit clone https://github.com/remarkablemark/googleapis-analytics-demo.git\ncd googleapis-analytics-demo\n```\n\nInstall the dependencies:\n\n```sh\nnpm install\n```\n\n## Authentication\n\nLogin to [Google Cloud Platform](https://console.cloud.google.com/). Agree to the **Terms of Service** if you haven't already.\n\nCreate a [New Project](https://console.cloud.google.com/projectcreate) with a **Project name** and **Project ID**.\n\nEnable the [Google Analytics API](https://console.cloud.google.com/marketplace/product/google/analytics.googleapis.com).\n\nGo to [Credentials](https://console.cloud.google.com/apis/credentials) and create a [Service account](https://console.cloud.google.com/iam-admin/serviceaccounts/create) credential, which enables [server-to-server, app-level authentication](https://cloud.google.com/docs/authentication/production) using robot accounts. Fill in the **Service account name** and **Service account ID** and click **Done**.\n\nIn [Credentials](https://console.cloud.google.com/apis/credentials), look for **Service Accounts** and click the newly created **Email**. Click **Keys** \u003e **Add Key** \u003e **Create new key** \u003e **Key type** \u003e **JSON** \u003e **Create**. The private key, which allows access to your cloud resources, will be saved to your computer.\n\nMove the key to the project directory:\n\n```sh\nmv path/to/project-id-abcdef123456.json auth.json\n```\n\nOnly `private_key` and `client_email` are necessary for JWT authorization. See [`auth.example.json`](auth.example.json):\n\n```json\n{\n  \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nabc123\\n-----END PRIVATE KEY-----\\n\",\n  \"client_email\": \"service-account-name@project-id-123456.iam.gserviceaccount.com\"\n}\n```\n\nAlternatively, the keys can be set in `.env`. See [`.env.example`](.env.example):\n\n```sh\nCLIENT_EMAIL=\"service-account-name@project-id-123456.iam.gserviceaccount.com\"\nPRIVATE_KEY=\"-----BEGIN PRIVATE KEY-----\\nabc123\\n-----END PRIVATE KEY-----\\n\"\n```\n\nOpen [Google Analytics](https://analytics.google.com/analytics/web/) and go to **Admin** \u003e **View Settings** and copy the **View ID**.\n\nSet `VIEW_ID` in `.env`. See `.env.example`:\n\n```sh\necho 'VIEW_ID=12345678' \u003e\u003e .env\n```\n\nGo back to **Admin** and go to **View User Management**. In **View permissions**, click **+** to **Add users** and add the service account email `client_email`.\n\n## Run\n\n### `npm start`\n\nPrints the Google Analytics real-time data for a view (profile). See [Real Time Reporting API](https://developers.google.com/analytics/devguides/reporting/realtime/v3/reference).\n\n## License\n\n[MIT](LICENSE)\n","funding_links":["https://github.com/sponsors/remarkablemark","https://patreon.com/remarkablemark","https://ko-fi.com/remarkablemark","https://liberapay.com/remarkablemark","https://thanks.dev/u/gh/remarkablemark","https://b.remarkabl.org/teespring"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkablemark%2Fgoogleapis-analytics-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremarkablemark%2Fgoogleapis-analytics-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkablemark%2Fgoogleapis-analytics-demo/lists"}