chore: analytics + deps
This commit is contained in:
parent
4ae4a7416e
commit
bf6d4f446b
14 changed files with 55 additions and 54 deletions
|
@ -1,15 +1,18 @@
|
|||
import EleventyFetch from '@11ty/eleventy-fetch'
|
||||
|
||||
export default async function () {
|
||||
const SITE_ID_CLICKY = process.env.SITE_ID_CLICKY
|
||||
const SITE_KEY_CLICKY = process.env.SITE_KEY_CLICKY
|
||||
const url = `https://api.clicky.com/api/stats/4?site_id=${SITE_ID_CLICKY}&sitekey=${SITE_KEY_CLICKY}&type=pages&output=json`
|
||||
const API_KEY_PLAUSIBLE = process.env.API_KEY_PLAUSIBLE
|
||||
const url =
|
||||
'https://plausible.io/api/v1/stats/breakdown?site_id=coryd.dev&period=6mo&property=event:page&limit=30'
|
||||
const res = EleventyFetch(url, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
headers: {
|
||||
Authorization: `Bearer ${API_KEY_PLAUSIBLE}`,
|
||||
},
|
||||
},
|
||||
}).catch()
|
||||
const data = await res
|
||||
const pages = data[0].dates[0].items
|
||||
|
||||
return pages.filter((p) => p.url.includes('posts'))
|
||||
const pages = await res
|
||||
return pages.results.filter((p) => p.page.includes('posts'))
|
||||
}
|
Reference in a new issue