browserslist-ga-export

Generate browserslist-stats.json using Browserslist-GA without logging into a Google Account.

Showing:

Popularity

Downloads/wk

4.7K

GitHub Stars

47

Maintenance

Last Commit

5mos ago

Contributors

3

Package

Dependencies

4

Size (min+gzip)

101.9KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

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):
    1. Operating System
    2. Operating System Version
    3. Browser
    4. Browser Version
    5. 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:

  1. View the custom report.
  2. Sort the report by Browser column ascending alphabetically (arrow in column header facing up).
  3. Select the desired date range for the report.
  4. Show 5000 rows for the report.
  5. 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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial