File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,16 @@ if (timezone < 0) {
31
31
timezone = timezone . replace ( "+" , "-" ) ;
32
32
}
33
33
34
- const url = `https://analytics.services.netlify.com/v1/${ siteId } /pageviews?from=${ startDate . getTime ( ) . toFixed ( ) } &to=${ endDate . getTime ( ) } &timezone=${ timezone } &resolution=day`
35
34
36
35
console . log ( url ) ;
37
36
38
37
async function start ( ) {
38
+ getMetric ( "pageviews" ) ;
39
+ getMetric ( "visitors" ) ;
40
+ }
41
+
42
+ async function getMetric ( metric ) {
43
+ const url = `https://analytics.services.netlify.com/v1/${ siteId } /${ metric } ?from=${ startDate . getTime ( ) . toFixed ( ) } &to=${ endDate . getTime ( ) } &timezone=${ timezone } &resolution=day` ;
39
44
var res = await fetch ( url , {
40
45
"credentials" : "include" ,
41
46
"headers" : {
@@ -49,7 +54,7 @@ async function start() {
49
54
} ) ;
50
55
51
56
const response = await res . json ( ) ;
52
- writeToCSV ( response . data , "pageviews" ) ;
57
+ writeToCSV ( response . data , metric ) ;
53
58
}
54
59
55
60
function writeToCSV ( data , metric ) {
You can’t perform that action at this time.
0 commit comments