Skip to content

Commit fd900b0

Browse files
authored
Fix/Netlify Analytics API v1 deprecation & switch to v2 (#10)
* super simple adaption to new api version * for now just changed api version in url nothing else seemingly
1 parent 8883cfc commit fd900b0

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function start() {
5353
}
5454

5555
async function getMetric(metric) {
56-
const url = `https://analytics.services.netlify.com/v1/${siteId}/${metric}?from=${startDate.getTime().toFixed()}&to=${endDate.getTime()}&timezone=${timezone}&resolution=day`;
56+
const url = `https://analytics.services.netlify.com/v2/${siteId}/${metric}?from=${startDate.getTime().toFixed()}&to=${endDate.getTime()}&timezone=${timezone}&resolution=day`;
5757
try {
5858
var res = await fetch(url, {
5959
"credentials": "include",

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netlify-analytics-collector",
3-
"version": "1.2.0",
3+
"version": "1.2.0-api-v2-rc.1",
44
"description": "A simple NodeJs application which saves netlify analytics to a CSV file",
55
"main": "index.js",
66
"directories": {

0 commit comments

Comments
 (0)