{"id":13826291,"url":"https://github.com/browserslist/browserslist-ga-export","last_synced_at":"2025-03-17T14:11:25.609Z","repository":{"id":36941758,"uuid":"132913158","full_name":"browserslist/browserslist-ga-export","owner":"browserslist","description":"Generate browserslist-stats.json using Browserslist-GA without logging into a Google Account.","archived":false,"fork":false,"pushed_at":"2023-07-03T02:31:44.000Z","size":33,"stargazers_count":68,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T00:05:28.332Z","etag":null,"topics":[],"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/browserslist.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}},"created_at":"2018-05-10T14:38:17.000Z","updated_at":"2025-02-11T07:23:20.000Z","dependencies_parsed_at":"2024-01-18T04:08:15.222Z","dependency_job_id":"95eac68f-60c7-4bcf-b476-85b903410831","html_url":"https://github.com/browserslist/browserslist-ga-export","commit_stats":{"total_commits":31,"total_committers":5,"mean_commits":6.2,"dds":"0.19354838709677424","last_synced_commit":"1ee3e88c52b33e846fc4c06ec6818d00ab004219"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserslist%2Fbrowserslist-ga-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserslist%2Fbrowserslist-ga-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserslist%2Fbrowserslist-ga-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserslist%2Fbrowserslist-ga-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browserslist","download_url":"https://codeload.github.com/browserslist/browserslist-ga-export/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241942492,"owners_count":20046351,"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":[],"created_at":"2024-08-04T09:01:35.141Z","updated_at":"2025-03-05T04:14:29.539Z","avatar_url":"https://github.com/browserslist.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# browserslist-ga-export\n\n## Overview\n\n`browserslist-ga-export` allows you to generate a `browserslist-stats.json` file for Google Analytics data using the [Browserslist-GA](https://github.com/browserslist/browserslist-ga) parser without requiring you to log into a Google Account. Instead of logging into a Google Account, you must provide a CSV export of Google Analytics data.\n\n## Installation\n\n```bash\nnpm install browserslist-ga-export --save-dev\n```\n\n## Usage\n\n### Google Analytics 4\n\n#### 1) Create exploration\n\nCreate a blank [Exploration](https://support.google.com/analytics/answer/7579450) with the specifications listed below:\n\n  - **Date range**: Desired date range\n  - **Dimensions**:\n    1. Operating system\n    2. OS version\n    3. Browser\n    4. Browser version\n    5. Device category\n  - **Metrics**: Views\n  - **Rows** (in this order):\n    1. Operating system\n    2. OS version\n    3. Browser\n    4. Browser version\n    5. Device category\n  - **Values**: Views\n\n#### 2) Export exploration CSV\n\nPress the Export Data button and select the CSV option.\n\n#### 3) Generate `browserslist-stats.json`\n\nUse the `browserslist-ga-export` CLI to generate a `browserslist-stats.json` file based on the CSV file. See [CLI documentation](#cli) for more details.\n\n```bash\nbrowserslist-ga-export --reportPath {String} [options]\n```\n\n### Universal Analytics\n\n#### 1) Check user language setting\n\nEnsure that language is set to \"English (United States)\" in [user language settings](https://support.google.com/analytics/answer/3210078?hl=en). See [#5](https://github.com/browserslist/browserslist-ga-export/pull/5) and [#14](https://github.com/browserslist/browserslist-ga-export/issues/14) for an explanation of why this is necessary.\n\n#### 2) Create custom report\n\n[Create a custom report](https://support.google.com/analytics/answer/1151300?hl=en) with the specifications listed below. You will be able to use this custom report for one or more desired [Google Analytics view(s)](https://support.google.com/analytics/answer/2649553?hl=en) associated with a [Google Analytics account](https://support.google.com/analytics/topic/1009690?hl=en\u0026ref_topic=1726911).\n\n  - **Type**: Flat Table\n  - **Dimensions** (in this order):\n    1. Operating System\n    2. Operating System Version\n    3. Browser\n    4. Browser Version\n    5. Device Category\n  - **Metrics**: Pageviews\n\n#### 3) Export custom report CSV file(s)\n\nFor each desired view, follow these steps to export the custom report as a CSV file:\n\n1. View the custom report.\n2. Sort the report by Browser column ascending alphabetically (arrow in column header facing up).\n3. Select the desired date range for the report.\n4. Show 5000 rows for the report.\n5. [Export the report as a CSV file](https://support.google.com/analytics/answer/1038573?hl=en).\n6. If your report has more than 5,000 rows, you must export each page of the report individually.\n\n#### 4) Generate `browserslist-stats.json` file based on CSV file(s)\n\nUse the browserslist-ga-export CLI to generate a `browserslist-stats.json` file based on the CSV file(s). See [CLI documentation](#cli) for more details.\n\n```bash\nbrowserslist-ga-export --reportPath {String} --firstRowIndex 7 [options]\n```\n\n## CLI\n\n### `browserslist-ga-export`\n\nGenerate a `browserslist-stats.json` file based on one or more Google Analytics data CSV files (see [usage instructions](#usage)).\n\n#### Options\n\n##### `--reportPath` (`-r`)\n\nPath or [glob](https://www.npmjs.com/package/fast-glob) path pattern of CSV file(s) to process. If a glob path pattern is provided that resolves to multiple files, the `browserslist-stats.json` file will represent the merged data of those files.\n\n- Required\n- Type: string\n\n##### `--firstRowIndex` (`-f`)\n\nZero-based index of first data row in CSV file. Default value is based on the default format of Google Analytics 4 CSV exports.\n\n- Optional\n- Type: number\n- Default: `8`\n\n##### `--outputPath` (`-o`)\n\nOutput path for generated `browserslist-stats.json` file. If a file already exists at the path, that file will be overwritten.\n\n- Optional\n- Type: string\n- Default: `'browserslist-stats.json'`\n\n#### Examples\n\nGenerate `browserslist-stats.json` from a Google Analytics 4 CSV file called `browserslist-report.csv`:\n\n```bash\nbrowserslist-ga-export --reportPath browserslist-report.csv\n```\n\nGenerate `browserslist-stats.json` from a Universal Analytics CSV file called `browserslist-report.csv`:\n\n```bash\nbrowserslist-ga-export --reportPath browserslist-report.csv --firstRowIndex 7\n```\n\nGenerate `browserslist-stats.json` from multiple CSV files in a folder called `browserslist-reports`:\n\n```bash\nbrowserslist-ga-export -r browserslist-reports/*.csv\n```\n\nGenerate custom usage data file called `browser-stats.json` instead of `browserslist-stats.json`:\n\n```bash\nbrowserslist-ga-export -r browserslist-report.csv -o browser-stats.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserslist%2Fbrowserslist-ga-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserslist%2Fbrowserslist-ga-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserslist%2Fbrowserslist-ga-export/lists"}