Generate browserslist-stats.json
using Browserslist-GA without logging into a Google Account.
browserslist-ga-export allows you to generate the same browserslist-stats.json
that Browserslist-GA would generate for a Google Analytics view without requiring you to log into a Google Account. Instead of logging into a Google Account, you must provide a CSV export of a Google Analytics custom report.
If you are using npm:
$ npm install --save-dev browserslist/browserslist-ga-export
If you are using Yarn:
$ yarn add https://github.com/browserslist/browserslist-ga-export.git
- Create a custom report for the desired Google Analytics view using the following format:
- Type: Flat Table
- Dimensions (in this order): Operating System, Operating System Version, Browser, Browser Version, Mobile (Including Tablet)
- Metrics: Pageviews
- View the report.
- Sort the report by Browser ascending.
- Select the desired date range for the report.
- Show 5000 rows for the report.
- Export the report as a CSV.
If you are using npm v5.2.0 or higher:
$ npx browserslist-ga-export --reportPath {path-to-export}.csv
If you are using Yarn:
$ yarn browserslist-ga-export --reportPath {path-to-export}.csv
You can also add a script to package.json, for example:
"scripts": {
"update-browserslist-stats": "browserslist-ga-export --reportPath {path-to-export}.csv"
}
Name | Type | Default | Description |
---|---|---|---|
ignoreRows |
{Number} |
7 |
Number of rows at beginning of CSV file to exclude from data passed to Browserslist-GA. The default value is based on the default format of Google Analytics custom report CSV exports. |
outputPath |
{String} |
'browserslist-stats.json' |
Path for exported browserslist-stats file. |
reportPath |
{String} |
null |
Path of report CSV to process. |