Skip to content
Generate browserslist-stats.json using Browserslist-GA without logging into a Google Account.
JavaScript
Branch: master
Clone or download

Latest commit

galvarez421 Increase version number
- Increment package version number to reflect changes since previous
  release.
Latest commit d1feede Mar 11, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Update browserslist-ga version Feb 17, 2020
LICENSE Initial commit May 10, 2018
README.MD Update browserslist-ga version Feb 17, 2020
index.js Add CLI script May 11, 2018
package.json Increase version number Mar 12, 2020

README.MD

browserslist-ga-export

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.

Installation

If you are using npm:

$ npm install --save-dev browserslist-ga-export

If you are using Yarn:

$ yarn add --dev browserslist-ga-export

Usage

1) Export custom report as CSV

  1. Create a custom report for the desired Google Analytics view using the format below (the language you see in Google Analytics may vary depending on your user language settings):
    • Type: Flat Table
    • Dimensions (in this order):
      1. Operating System
      2. Operating System Version
      3. Browser
      4. Browser Version
      5. Device Category
    • Metrics: Pageviews or Page Views
  2. View the report.
  3. Sort the report by Browser column ascending alphabetically (arrow in column header facing up).
  4. Select the desired date range for the report.
  5. Show 5000 rows for the report.
  6. Export the report as a CSV.

2) Convert CSV into browserslist-stats.json

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"
}

3) Query against your custom usage data

CLI Options

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.
You can’t perform that action at this time.