You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This actions archives your analytics data from Netlify Analytics
3
+
> :warning:This tool uses an unofficial/unpublisehd API from Netlify. It may break any time!
4
4
5
-
See [.github/workflows](./.github/workflows)for examples.
5
+
[Netlify Analytics](https://www.netlify.com/products/analytics/) is awesome but currently it only shows you data for the last 30 days. You can archive analytics from Netlify Analytics with this tool into CSV files. It either runs with NodeJS locally or can be added to Github repos as a Github action that runs on a schedule.
6
6
7
-
Running as Github Action or NodeJS app.
7
+
You can find example Github Actions in [.github/workflows](.github/workflows).
8
+
9
+
*`example.yml` is set to run every day just before midnight to create 1 a zip file with the analytics of the last 30 days and 2 adds the analytics for the current day to a Google Sheet.
10
+
*`summary-release.yml` Is a workflow that runs on the first day of each month and creates a new release in the Github repo with an zip with CSV files of the analtics data from the past month.
11
+
12
+
These are the workflows I came up and you can probably built even cooler workflows. Let me know!
13
+
14
+
## Setup
15
+
16
+
You need to setup some secrets either as secrets for actions or environment variables.
17
+
18
+
*`NETLIFY_SITE` - You need the **API ID** of your Netlify site with analytics enabled. You can find it on your sites settings page.
19
+
*`NETLIFY_TOKEN` - You need a personal access token for your Netlify account to login in. You can generate a token [here](https://app.netlify.com/user/applications/personal)
20
+
21
+
### For Google Sheets
22
+
23
+
The example workflow uses [this action](https://github.com/canonical-web-and-design/csv-to-google-spreadsheet). Please read there how to set the action if you need it.
0 commit comments