All Projects → browserslist → browserslist-ga-export

browserslist / browserslist-ga-export

Licence: MIT license
Generate browserslist-stats.json using Browserslist-GA without logging into a Google Account.

Programming Languages

javascript
184084 projects - #8 most used programming language

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. This tool also allows you to generate a custom usage data file representing the merged data of multiple CSV files.

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.
  6. If your report has more than 5,000 rows, you must export each page of the report individually.

4) Generate custom usage data file based on CSV file(s)

Use the browserslist-ga-export CLI to generate a custom usage data file based on the CSV file(s). See CLI documentation for more details.

browserslist-ga-export --reportPath {String} [options]

CLI

browserslist-ga-export

Create a custom usage data JSON file based on one or more Google Analytics custom report CSV files (see usage instructions).

Options

--reportPath (-r)

Path or glob path pattern of report CSV file(s) to process. If a glob path pattern is provided that resolves to multiple files, the custom usage data file will represent the merged data of those files.

  • 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. If a file already exists at --outputPath, that file will be overwritten.

  • 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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].