JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q29506F
  • License MIT

Fetch structured data from Google Analytics

Package Exports

  • @mlx/ga

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mlx/ga) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

GA

Allows you to fetch data from Google analytics. Combined with @mlx/parser you can aggregate the route information and map it to your application's parametrized routes:

const { fetch } = require('@mlx/ga');
const { parseRoutes, ProjectType } = require('@mlx/parser');
const { writeFileSync } = require('fs');

const key = require('./credentials.json');
const viewId = '000000000';

const applicationRoutes = parseRoutes('tsconfig.app.json', ProjectType.Angular);

fetch({
  key,
  viewId,
  period: {
    startDate: new Date('2016-1-1'),
    endDate: new Date('2018-2-24')
  },
  formatter: r => r.replace('/app', ''),
  routes: applicationRoutes.map(f => f.path)
}).then(g => {
  writeFileSync('data.json', JSON.stringify(g, null, 2));
});

For more details visit https://github.com/mgechev/mlx.

License

MIT