README
browserslist-ga-export
Overview
Generate browserslist-stats.json
using Browserslist-GA without logging into a Google Account.
browserslist-ga-export allows you to generate the same Browserslist custom usage data file 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. You may optionally provide multiple CSV files to generate a custom usage data file representing the merged data of multiple views.
Installation
npm install browserslist-ga-export --save-dev
Usage
1) Check user language setting
Ensure that language is set to "English (United States)" in user language settings. See #5 and #14 for an explanation of why this is necessary.
2) Create custom report
Create a custom report with the specifications listed below. You will be able to use this custom report for one or more desired Google Analytics view(s) associated with a Google Analytics account.
- Type: Flat Table
- Dimensions (in this order):
- Operating System
- Operating System Version
- Browser
- Browser Version
- Device Category
- Metrics: Pageviews
3) Export custom report CSV file(s)
For each desired view, follow these steps to export the custom report as a CSV file:
- View the custom report.
- Sort the report by Browser column ascending alphabetically (arrow in column header facing up).
- Select the desired date range for the report.
- Show 5000 rows for the report.
- Export the report as a CSV file.
4) Convert CSV file(s) into custom usage data file
Use the browserslist-ga-export CLI to convert the CSV file(s) into a custom usage data file (browserslist-stats.json
by default). See CLI documentation for more details.
browserslist-ga-export --reportPath {String} [options]
CLI
Commands
browserslist-ga-export
Create or update a custom usage data JSON file from one or more report CSV files given a report path and an output path.
Options
( --reportPath-r
)
Path or glob path pattern of report CSV file(s) to process.
- Required
- Type: string
( --ignoreRows-i
)
Number of rows at beginning of report CSV file(s) to exclude from processing. Default value is based on the default format of Google Analytics custom report CSV exports.
- Optional
- Type: number
- Default:
7
( --outputPath-o
)
Output path for generated custom usage data file.
- Optional
- Type: string
- Default:
'browserslist-stats.json'
Examples
browserslist-ga-export --reportPath browserslist-report.csv
browserslist-ga-export -r browserslist-reports/*.csv
browserslist-ga-export -r browser-report.csv -o browser-stats.json
browserslist-ga-export -r browser-report.csv -i 0