chore: analytics + deps

This commit is contained in:
Cory Dransfeldt 2024-06-06 09:20:21 -07:00
parent 4ae4a7416e
commit bf6d4f446b
No known key found for this signature in database
14 changed files with 55 additions and 54 deletions

View file

@ -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'))
}

View file

@ -76,7 +76,6 @@
<title>{{ pageTitle }}</title>
<link rel="preload" href="/assets/fonts/MonoLisa.min.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="/assets/styles/index.css?v={% appVersion %}" type="text/css" />
<script async data-id="101449513" src="/23af0256fe76a.js"></script>
<link rel="canonical" href="{{ fullUrl }}" />
<meta property="og:title" content="{{ pageTitle }}" />
<meta name="description" content="{{ pageDescription | escape | strip }}" />
@ -100,6 +99,8 @@
<link rel="alternate" href="https://feedpress.me/coryd-artist-charts" title="{{ meta.siteName }}'s artist charts feed" type="application/rss+xml">
<link rel="alternate" href="https://feedpress.me/coryd-all" title="{{ meta.siteName }}'s activity feed" type="application/rss+xml">
<link type="text/plain" rel="author" href="/humans.txt" />
<script defer data-domain="coryd.dev" src="/js/script.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
@ -132,7 +133,6 @@
</script>
<noscript>
<style>.client-side {display:none}</style>
<p><img width="1" height="1" src="/7afb285ad050d" /></p>
</noscript>
</head>
<body>

View file

@ -7,4 +7,5 @@ permalink: /400.html
<div class="text-centered">
<h2 class="page-header">{{ title }}</h2>
<p>Nah, that's a bad request.</p>
</div>
</div>
<script>document.addEventListener('DOMContentLoaded', function () { plausible('400', { props: { path: document.location.pathname } }); });</script>

View file

@ -31,4 +31,5 @@ image: /assets/img/404.jpg
</div>
<hr class="large-spacing" />
{% render "partials/widgets/addon-links.liquid", popularPosts:collections.popularPosts, links:links %}
</div>
</div>
<script>document.addEventListener('DOMContentLoaded', function () { plausible('404', { props: { path: document.location.pathname } }); });</script>

View file

@ -32,7 +32,7 @@ permalink: /search.html
const query = $input.value
const results = (query.length > 1) ? getSearchResults(query) : []
if (query === '') renderSearchResults([])
if (results && window.clicky) clicky.log('/search', query, 'click')
if (results && typeof plausible === 'function') plausible('Search', { props: { query: query } });
renderSearchResults(results)
})

View file

@ -5,7 +5,8 @@ permalink: /blogroll.html
description: These are awesome blogs that I enjoy and you may enjoy too.
---
<h2 class="page-header">{{ title }}</h2>
<p>You can <a onclick="clicky?.log('/blogroll','OPML download', 'download');" href="/blogroll.opml">download an OPML file</a> containing all of these feeds and import them into your RSS reader.</p>
<p>You can <a onclick="if (typeof plausible === 'function') { plausible('OPML download', { props: { action: 'download' } }) }" href="/blogroll.opml">Download OPML</a>
download an OPML file</a> containing all of these feeds and import them into your RSS reader.</p>
<table>
<tr>
<th>Name</th>

View file

@ -15,7 +15,7 @@ description: How to contact me.
<li>File an issue on the appropriate repo over at <a href="https://github.com/cdransf">GitHub</a></li>
</ul>
</div>
<form onsubmit="clicky?.log('/contact', 'Contact form submitted', 'click')" class="column" method="POST" action="/contact/success" name="contact" netlify netlify-honeypot="bot-field">
<form onsubmit="if (typeof plausible === 'function') { plausible('Contact form submitted', { props: { name: this.name.value, email: this.email.value, message: this.message.value } }) }" class="column" method="POST" action="/contact/success" name="contact" netlify netlify-honeypot="bot-field">
<label class="hidden">
Don't fill this out if you're human: <input name="bot-field" />
</label>

View file

@ -9,13 +9,11 @@ description: Save a little bit on services that I also use.
Referral links for services I use. I save some money, and you do as well if you choose to use them.
<ul class="link-list">
<li><a onclick="clicky?.log('/referrals','Fastmail referral', 'click')" href="https://ref.fm/u30190984">Fastmail</a></li>
<li><a onclick="clicky?.log('/referrals', 'Clicky referral', 'click')" href="https://clicky.com/101449513">Clicky</a></li>
<li><a onclick="clicky?.log('/referrals','NextDNS referral', 'click')" href="https://nextdns.io/?from=m56mt3z6">NextDNS</a></li>
<li><a onclick="clicky?.log('/referrals','DNSimple referral', 'click')" href="https://dnsimple.com/r/3a7cbb9e15df8f">DNSimple</a></li>
<li><a onclick="clicky?.log('/referrals','Bunny.net referral', 'click')" href="https://bunny.net?ref=revw3mehej">Bunny.net</a></li>
<li><a onclick="clicky?.log('/referrals','Feedpress referral', 'click')" href="https://feedpress.com/?affid=34370">Feedpress</a></li>
<li><a onclick="clicky?.log('/referrals','Proton referral', 'click')" href="https://pr.tn/ref/X775YX40Z50G">Proton</a></li>
<li><a onclick="clicky?.log('/referrals','DigitalOcean referral', 'click')" href="https://m.do.co/c/3635bf99aee2">DigitalOcean</a></li>
<li><a onclick="clicky?.log('/referrals','Garbage Day referral', 'click')" href="https://www.garbageday.email/subscribe?ref=4JeD4bFKQE">Garbage Day newsletter</a></li>
<li><a class="plausible-event-name=Fastmail+referral" href="https://ref.fm/u30190984">Fastmail</a></li>
<li><a class="plausible-event-name=NextDNS+referral" href="https://nextdns.io/?from=m56mt3z6">NextDNS</a></li>
<li><a class="plausible-event-name=DNSimple+referral" href="https://dnsimple.com/r/3a7cbb9e15df8f">DNSimple</a></li>
<li><a class="plausible-event-name=Feedpress+referral" href="https://feedpress.com/?affid=34370">Feedpress</a></li>
<li><a class="plausible-event-name=Proton+referral" href="https://pr.tn/ref/X775YX40Z50G">Proton</a></li>
<li><a class="plausible-event-name=DigitalOcean+referral" href="https://m.do.co/c/3635bf99aee2">DigitalOcean</a></li>
<li><a class="plausible-event-name=Garbage+Day+referral" href="https://www.garbageday.email/subscribe?ref=4JeD4bFKQE">Garbage Day newsletter</a></li>
</ul>

View file

@ -56,18 +56,17 @@ Software and services that I use for work and my own enjoyment.
<h3>Services</h3>
- <a onclick="clicky?.log('/uses','Fastmail referral', 'click')" href="https://ref.fm/u30190984">Fastmail</a>: the best, most reliable email, calendar and contacts provider around.
- <a onclick="clicky?.log('/uses','NextDNS referral', 'click')" href="https://nextdns.io/?from=m56mt3z6">NextDNS</a>: a privacy-focused, set it and forget it DNS service. I use their security features on my home network and a profile with strict ad-blocking rules on all of my devices.
- <a onclick="clicky?.log('/uses','DNSimple referral', 'click')" href="https://dnsimple.com/r/3a7cbb9e15df8f">DNSimple</a>: a robust, user-friendly DNS provider and registrar. I moved my domains here after my old provider was acquired.
- <a onclick="clicky?.log('/uses','Bunny.net referral', 'click')" href="https://bunny.net?ref=revw3mehej">Bunny.net</a>: a powerful and affordable CDN. I use it to serve assets on my personal site (most notable my now page — raw assets are fetched by Eleventy and then optimized to webp).
- <a class="plausible-event-name=Fastmail+referral" href="https://ref.fm/u30190984">Fastmail</a>: the best, most reliable email, calendar and contacts provider around.
- <a class="plausible-event-name=NextDNS+referral" href="https://nextdns.io/?from=m56mt3z6">NextDNS</a>: a privacy-focused, set it and forget it DNS service. I use their security features on my home network and a profile with strict ad-blocking rules on all of my devices.
- <a class="plausible-event-name=DNSimple+referral" href="https://dnsimple.com/r/3a7cbb9e15df8f">DNSimple</a>: a robust, user-friendly DNS provider and registrar. I moved my domains here after my old provider was acquired.
- [Netlify](https://netlify.com): I use their hosting, forms and webhooks. It's a reliable and feature-rich platform.
- <a onclick="clicky?.log('/uses', 'Clicky referral', 'click')" href="https://clicky.com/101449513">Clicky</a>: not the _prettiest_ analytics, but very feature rich.
- <a onclick="clicky?.log('/uses','Feedpress referral', 'click')" href="https://feedpress.com/?affid=34370">Feedpress</a>: they've been around for a while now and don't change much (nor do they need to), but look no further for reliable, helpful feed analytics.
- [Plausible](https://plausible.io): lightweight, privacy-friendly analytics.
- <a class="plausible-event-name=Feedpress+referral" href="https://feedpress.com/?affid=34370">Feedpress</a>: they've been around for a while now and don't change much (nor do they need to), but look no further for reliable, helpful feed analytics.
- [Feedbin](https://feedbin.com): performant, open and super reliable RSS.
- [Instapaper](https://instapaper.com): slow to change and often better for it — a reliable and steady read it later service.
- [forwardemail.net](https://forwardemail.net): a simple and reliable service for forwarding and routing emails from a few of the domains I own.
- [Backblaze](https://backblaze.com): It backs up my MacBook Air and attached storage drive and I don't have to think about it.
- <a onclick="clicky?.log('/uses','Proton referral', 'click')" href="https://pr.tn/ref/X775YX40Z50G">Proton</a>: a reliable, trustworthy VPN with all of the features you'd expect from such a service.
- <a class="plausible-event-name=Proton+referral" href="https://pr.tn/ref/X775YX40Z50G">Proton</a>: a reliable, trustworthy VPN with all of the features you'd expect from such a service.
<hr class="large-spacing" />