0.2.1 • Published 6 years ago

google-analytics-v4-report-flattener v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

google-analytics-v4-report-flattener

Converts Google Analytics API v4 reports to flat/delimited data.

This is a wrapper around this Rust package. Credit to Neon for doing the hard work for the Rust-Node bindings.

Rust is required to compile the library after running npm install.

toDelimited(data: string|object, delimiter: string): Array<string>

const { toDelimited } = require('google-analytics-v4-report-flattener')
const data = require('./test.json')

toDelimited(data, ",")
[ '"ga:deviceCategory","ga:sessions","ga:bounces"\n"desktop",25,17\n"mobile",2,2\n',
  '"ga:country","ga:sessions","ga:bounces"\n"Azerbaijan",1,0\n"France",18,11\n"Japan",4,4\n"Switzerland",1,1\n"United States",3,3\n' ]

toFlatJson(data: string|object)

const { toFlatJson } = require('google-analytics-v4-report-flattener')
const data = require('./test.json')

toFlatJson(data)
[
  [{
      'ga:bounces': 17,
      'ga:deviceCategory': 'desktop',
      'ga:sessions': 25
    },
    {
      'ga:bounces': 2,
      'ga:deviceCategory': 'mobile',
      'ga:sessions': 2
    }
  ],
  [{
      'ga:bounces': 0,
      'ga:country': 'Azerbaijan',
      'ga:sessions': 1
    },
    {
      'ga:bounces': 11,
      'ga:country': 'France',
      'ga:sessions': 18
    },
    {
      'ga:bounces': 4,
      'ga:country': 'Japan',
      'ga:sessions': 4
    },
    {
      'ga:bounces': 1,
      'ga:country': 'Switzerland',
      'ga:sessions': 1
    },
    {
      'ga:bounces': 3,
      'ga:country': 'United States',
      'ga:sessions': 3
    }
  ]
]
0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago