Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added importer from google analytics to index export
- Loading branch information
kanekotic
committed
Jul 2, 2018
1 parent
c199137
commit bbeb06c
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const importer = require('../lib/index').importer | ||
path = require('path') | ||
|
||
const email = 'your email' //email account from the user credentials | ||
keyPath = path.join(__dirname, 'your credentials')// path to credentials json or pem | ||
config = { | ||
viewId: "some viewId",//the view id to query | ||
daterange:{ | ||
"endDate":"2017-06-30", | ||
"startDate":"2016-06-30" | ||
}, | ||
metrics: "ga:users", | ||
dimensions: "ga:date" | ||
} | ||
|
||
const example = async () => { | ||
const result = await importer(email, keyPath, config) | ||
console.log(JSON.stringify(result.data)) | ||
} | ||
|
||
example() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
module.exports = {} | ||
const importer = require('./importer') | ||
|
||
module.exports = { importer } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
jest.mock('../../lib/importer', () => jest.fn()) | ||
|
||
const index = require('../../lib/index') | ||
importer = require('../../lib/importer') | ||
|
||
describe('index', () => { | ||
it('exports the importer',async () => { | ||
expect(index.importer).toBe(importer) | ||
}) | ||
}) |