feat: swap out analytics
This commit is contained in:
parent
a4fc73d653
commit
a9f474aa9d
15 changed files with 51 additions and 67 deletions
3
.env
3
.env
|
@ -2,7 +2,8 @@ ACCESS_KEY_B2=
|
|||
SECRET_KEY_B2=
|
||||
BUCKET_B2=
|
||||
API_KEY_LASTFM=
|
||||
API_KEY_PLAUSIBLE=
|
||||
SITE_ID=
|
||||
API_KEY_NETLIFY=
|
||||
API_KEY_TRAKT=
|
||||
API_KEY_MOVIEDB=
|
||||
API_TOKEN_READWISE=
|
||||
|
|
46
_redirects
46
_redirects
|
@ -2,12 +2,6 @@
|
|||
/.well-known/host-meta* https://social.lol/.well-known/host-meta:splat 301
|
||||
/.well-known/nodeinfo* https://social.lol/.well-known/nodeinfo:splat 301
|
||||
|
||||
# rewrites
|
||||
/favicon.ico /assets/img/favicon/favicon.ico 200!
|
||||
/apple-touch-icon.png /assets/img/favicon/apple-touch-icon.png 200!
|
||||
/apple-touch-icon-precomposed.png /assets/img/favicon/apple-touch-icon.png 200!
|
||||
/static/favicons/apple-touch-icon.png /assets/img/favicon/apple-touch-icon.png 200!
|
||||
|
||||
# blog posts
|
||||
/blog/fixing-safari-icloud-syncing /posts/2022/fixing-safari-icloud-syncing/ 301!
|
||||
/blog/migrating-to-fastmail /posts/2022/migrating-to-fastmail/ 301!
|
||||
|
@ -27,30 +21,22 @@
|
|||
/posts/2023/webmentions-in-eleventy/null /posts/2023/webmentions-in-eleventy/ 301!
|
||||
/posts/2023/a-safari-specific-guide-to-making-the-modern-web-suck-less/null /posts/2023/a-safari-specific-guide-to-making-the-modern-web-suck-less/ 301!
|
||||
/posts/2023/hacking-together-a-tweeklyfm-replacement/ /posts/2023/hacking-together-a-tweeklyfm-repalcement/
|
||||
/tags/.env /tags/env 301!
|
||||
|
||||
# 404s
|
||||
/robot.txt /robots.txt 301!
|
||||
/sitemap.txt /sitemap.xml 301!
|
||||
/assets/img/social-preview/adding-a-light/dark-theme-toggle-preview.jpeg /assets/img/social-preview/adding-a-light-dark-theme-toggle-preview.jpeg 301!
|
||||
/assets/img/social-card.jpg /assets/img/ogi/default.jpg 301!
|
||||
/posts / 301!
|
||||
/blog / 301!
|
||||
/posts/2024 / 301!
|
||||
/blog/digital-privacy-tools /posts/2021/digital-privacy-tools/ 301!
|
||||
/assets/img/social-preview/your-site-your-home-your-web- /assets/img/social-preview/your-site-your-home-your-web-preview.jpeg 301!
|
||||
/assets/img/social-preview/go-ahead-and-block-ai-web- /assets/img/social-preview/go-ahead-and-block-ai-web-crawlers-preview.jpeg 301!
|
||||
/tags/.env /tags/env 301!
|
||||
/tags/chatgpt/ /tags/ai/ 301!
|
||||
/tags/socialmedia /tags/social%20media/ 301!
|
||||
/robot.txt /robots.txt 301!
|
||||
/blog/digital-privacy-tools /posts/2021/digital-privacy-tools/ 301!
|
||||
/assets/img/social-card.jpg /assets/img/ogi/default.jpg 301!
|
||||
/assets/img/social-preview/your-site-your-home-your-web- /assets/img/social-preview/your-site-your-home-your-web-preview.jpeg 301!
|
||||
/assets/img/social-preview/adding-a-light/dark-theme-toggle-preview.jpeg /assets/img/social-preview/adding-a-light-dark-theme-toggle-preview.jpeg 301!
|
||||
/assets/img/social-preview/go-ahead-and-block-ai-web- /assets/img/social-preview/go-ahead-and-block-ai-web-crawlers-preview.jpeg 301!
|
||||
/-want-anything-your-ai-generates/ /posts/2024/i-dont-want-anything-your-ai-generates/ 301!
|
||||
/static/images/avatar.png /assets/img/avatar.png 301!
|
||||
/assets/img/logo.webp /assets/img/avatar.webp 301!
|
||||
/apple-touch-icon-precomposed.png /assets/icons/apple-touch-icon.png 301!
|
||||
/apple-touch-icon /assets/icons/apple-touch-icon.png 301!
|
||||
/static/favicons/apple-touch-icon.png /assets/icons/apple-touch-icon.png 301!
|
||||
/favicon.ico /assets/icons/favicon.ico 301!
|
||||
/assets/img/cache/avatar-800w.webp /assets/img/cache/avatar-880w.webp 301!
|
||||
/assets/img/ogi/default.jpg /assets/img/avatar.webp 301!
|
||||
|
||||
# 400s
|
||||
/wp-* /400/ 400
|
||||
|
@ -70,13 +56,19 @@
|
|||
//test/ /400/ 400
|
||||
|
||||
# assets
|
||||
/favicon.ico /assets/icons/favicon.ico 200!
|
||||
/apple-touch-icon.png /assets/icons/apple-touch-icon.png 200!
|
||||
/apple-touch-icon /assets/icons/apple-touch-icon.png 200!
|
||||
/apple-touch-icon-precomposed.png /assets/icons/apple-touch-icon.png 200!
|
||||
/static/favicons/apple-touch-icon.png /assets/icons/apple-touch-icon.png 200!
|
||||
/static/images/avatar.png /assets/img/avatar.png 301!
|
||||
/static/images/avatar.webp /assets/img/avatar.webp 301!
|
||||
/assets/img/cache/avatar-800w.webp /assets/img/cache/avatar-880w.webp 301!
|
||||
/assets/img/favicon/apple-touch-icon.png /assets/icons/apple-touch-icon.png 301!
|
||||
/apple-touch-icon.png /assets/icons/apple-touch-icon.png 301!
|
||||
/apple-touch-icon-precomposed.png /assets/icons/apple-touch-icon.png 301!
|
||||
/favicon.ico /assets/icons/favicon.ico 301!
|
||||
/assets/img/favicon/favicon-32x32.png /assets/icons/favicon.ico 301!
|
||||
/assets/img/favicon/favicon-16x16.png /assets/icons/favicon.ico 301!
|
||||
/assets/img/logo.webp /assets/img/avatar.webp 301!
|
||||
/assets/img/ogi/default.jpg /assets/img/avatar.webp 301!
|
||||
|
||||
# general
|
||||
/articles/ / 301!
|
||||
|
@ -101,8 +93,4 @@ https://cdme.netlify.app https://coryd.dev 301!
|
|||
/links.xml https://feedpress.me/coryd-links
|
||||
/links.json https://feedpress.me/coryd-links.json
|
||||
/follow.xml https://feedpress.me/coryd-follow
|
||||
/follow.json https://feedpress.me/coryd-follow.json
|
||||
|
||||
# analytics
|
||||
/js/script.js https://plausible.io/js/script.outbound-links.tagged-events.js 200
|
||||
/api/event https://plausible.io/api/event 200
|
||||
/follow.json https://feedpress.me/coryd-follow.json
|
|
@ -47,11 +47,11 @@ export default {
|
|||
getPopularPosts: (posts, analytics) => {
|
||||
return posts
|
||||
.filter((post) => {
|
||||
if (analytics.find((p) => p.page === post.url)) return true
|
||||
if (analytics.find((p) => p.resource === post.url)) return true
|
||||
})
|
||||
.sort((a, b) => {
|
||||
const visitors = (page) => analytics.filter((p) => p.page === page.url).pop().visitors
|
||||
return visitors(b) - visitors(a)
|
||||
const count = (page) => analytics.filter((p) => p.resource === page.url).pop().count
|
||||
return count(b) - count(a)
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "8.4.6",
|
||||
"version": "8.5.0",
|
||||
"description": "The source for my personal site. Built using 11ty.",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
import EleventyFetch from '@11ty/eleventy-fetch'
|
||||
|
||||
export default async function () {
|
||||
const API_KEY_PLAUSIBLE = process.env.API_KEY_PLAUSIBLE
|
||||
const API_KEY_NETLIFY = process.env.API_KEY_NETLIFY
|
||||
const SITE_ID = process.env.SITE_ID
|
||||
const endDate = new Date();
|
||||
const startDate = new Date(new Date().setDate(endDate.getDate() - 30));
|
||||
const timezoneOffset = new Date().getTimezoneOffset() / 60;
|
||||
const url =
|
||||
'https://plausible.io/api/v1/stats/breakdown?site_id=coryd.dev&period=6mo&property=event:page&limit=30'
|
||||
`https://analytics.services.netlify.com/v2/${SITE_ID}/ranking/pages?from=${startDate.getTime()}&to=${endDate.getTime()}&timezone=-0${timezoneOffset}00&limit=50`
|
||||
const res = EleventyFetch(url, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
headers: {
|
||||
Authorization: `Bearer ${API_KEY_PLAUSIBLE}`,
|
||||
Authorization: `Bearer ${API_KEY_NETLIFY}`,
|
||||
},
|
||||
},
|
||||
}).catch()
|
||||
const pages = await res
|
||||
return pages.results.filter((p) => p.page.includes('posts'))
|
||||
const responseObject = await res
|
||||
const pages = responseObject['data']
|
||||
return pages.filter((p) => p.resource.includes('posts'))
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ pageTitle }}</title>
|
||||
<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>
|
||||
<link rel="preload" href="/assets/fonts/Poppins-Bold.min.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="/assets/fonts/Poppins-Regular.min.woff2" as="font" type="font/woff2" crossorigin>
|
||||
{% capture css %}
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
const query = $input.value
|
||||
const results = (query.length > 1) ? getSearchResults(query) : []
|
||||
if (query === '') renderSearchResults([])
|
||||
if (results && plausible) plausible(`Search query: ${query}`)
|
||||
renderSearchResults(results)
|
||||
})
|
||||
|
||||
|
|
|
@ -17,9 +17,4 @@ image: /assets/img/404.jpg
|
|||
<hr class="large__spacing" />
|
||||
{% render "partials/tags.liquid", tags:collections.tagsSortedByCount, hasSpace:true %}
|
||||
{% render "partials/addon-links.liquid", posts:collections.posts, analytics:analytics, links:links %}
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
plausible('404', { props: { path: document.location.pathname } })
|
||||
})
|
||||
</script>
|
||||
</div>
|
|
@ -9,7 +9,7 @@ description: 'These are awesome blogs that I enjoy and you may enjoy too.'
|
|||
{% endcapture %}
|
||||
<style>{{ css }}</style>
|
||||
<h2 class="page__header">{{ title }}</h2>
|
||||
<p>You can <a class="plausible-event-name=OPML+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 href="/blogroll.opml">download an OPML file</a> containing all of these feeds and import them into your RSS reader.</p>
|
||||
<div class="blog__banner--grid">
|
||||
{% for blog in blogroll %}
|
||||
<div class="blog__banner">
|
||||
|
|
|
@ -8,11 +8,9 @@ description: 'Referral links for services that I 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 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=bunny+referral" href="https://bunny.net?ref=revw3mehej">Bunny.net</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>
|
||||
</ul>
|
||||
- [NextDNS](https://nextdns.io/?from=m56mt3z6)
|
||||
- [DNSimple](https://dnsimple.com/r/3a7cbb9e15df8f)
|
||||
- [Bunny.net](https://bunny.net?ref=revw3mehej)
|
||||
- [Feedpress](https://feedpress.com/?affid=34370)
|
||||
- [Proton](https://pr.tn/ref/X775YX40Z50G)
|
||||
- [DigitalOcean](https://m.do.co/c/3635bf99aee2)
|
|
@ -60,11 +60,11 @@ Software and services that I use for work and my own enjoyment.
|
|||
<h3>Services</h3>
|
||||
|
||||
- [HEY](https://hey.com): it's the email service that works best for me and I quite enjoy their calendar.
|
||||
- <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.
|
||||
- <a class="plausible-event-name=bunny+referral" 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).
|
||||
- [Plausible](https://plausible.io): powerful, well-designed and privacy-respecting 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.
|
||||
- [NextDNS](https://nextdns.io/?from=m56mt3z6): 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.
|
||||
- [DNSimple](https://dnsimple.com/r/3a7cbb9e15df8f): a robust, user-friendly DNS provider and registrar. I moved my domains here after my old provider was acquired.
|
||||
- [Bunny.net](https://bunny.net?ref=revw3mehej): 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).
|
||||
- [Netlify](https://netlify.com):I use their hosting, forms, webhooks and analytics. It's a reliable and feature-rich platform.
|
||||
- [Feedpress](https://feedpress.com/?affid=34370): 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.
|
||||
- [Kagi](https://kagi.com): the only search engine at this point (or so it seems) that's interested in surfacing quality results.
|
||||
- [Readwise Reader](https://readwise.io/read): an impressive RSS reader that handles all the functionality you'd expect from a read it later app beautifully. It's as powerful as it is flexible.
|
||||
- [Todoist](https://todoist.com): the task manager I always return to for it's flexibility and endless integrations.
|
||||
|
@ -75,6 +75,6 @@ Software and services that I use for work and my own enjoyment.
|
|||
- [Slack](http://slack.com): I have a family Slack set up to avoid group text messages and am in a few other community Slacks.
|
||||
- [Discord](http://discord.com): I don't _like_ Discord but, for better or worse, it's where some communities I frequent are.
|
||||
- [Backblaze](https://backblaze.com): It backs up my MacBook Air and attached storage drive and I don't have to think about it.
|
||||
- <a class="no-underline plausible-event-name=Proton+referral" href="https://pr.tn/ref/X775YX40Z50G">Proton VPN</a>: a reliable, trustworthy VPN with all of the features you'd expect from such a service.
|
||||
- [Proton VPN](https://pr.tn/ref/X775YX40Z50G): a reliable, trustworthy VPN with all of the features you'd expect from such a service.
|
||||
|
||||
Check out [uses.tech](https://uses.tech) for more lists like this one.
|
||||
|
|
|
@ -11,7 +11,7 @@ A rundown of privacy tools that work well with Apple's technology ecosystem.<!--
|
|||
|
||||
Ubiquitous free email providers profit by mining user data (whether humans are involved or not). Your inbox acts as a key to your digital life, and you should avoid using any provider that monetizes its contents.
|
||||
|
||||
- <a class="plausible-event-name=Fastmail+referral" href="https://ref.fm/u30190984">Fastmail</a>[^2]: based in Melbourne, Australia Fastmail offers a range of affordably priced plans with a focus on support for open standards (including active development support for [JMAP](https://jmap.io) and the [Cyrus IMAP email server](https://fastmail.blog/open-technologies/why-we-contribute/)). They also [articulate a clear commitment to protecting and respecting your privacy](https://www.fastmail.com/values/) and offer an extensive [rundown of the privacy and security measures they employ on their site](https://www.fastmail.com/privacy-and-security/).
|
||||
- [Fastmail](https://ref.fm/u30190984)[^2]: based in Melbourne, Australia Fastmail offers a range of affordably priced plans with a focus on support for open standards (including active development support for [JMAP](https://jmap.io) and the [Cyrus IMAP email server](https://fastmail.blog/open-technologies/why-we-contribute/)). They also [articulate a clear commitment to protecting and respecting your privacy](https://www.fastmail.com/values/) and offer an extensive [rundown of the privacy and security measures they employ on their site](https://www.fastmail.com/privacy-and-security/).
|
||||
- I would also recommend exploring their [masked email implementation](https://www.fastmail.help/hc/en-us/articles/4406536368911-Masked-Email), which integrates seamlessly with [1Password](https://1password.com) (though using 1Password isn't required).
|
||||
- [mailbox.org](https://mailbox.org): based in Germany, [mailbox.org](http://mailbox.org) also has [a long history](https://mailbox.org/en/company#our-history) and [commitment to privacy](https://mailbox.org/en/company#our-mission). Their service is reliable, straightforward and fully featured (it's based off of a customized implementation [Open-Xchange](https://www.open-xchange.com)) and supports features like incoming address blocking, PGP support and so forth.
|
||||
- [Proton Mail](http://protonmail.com): Proton offers a host of encrypted tools, ranging from mail to drive, calendaring and VPN services. They're also the only option in this list that includes end-to-end encryption. The service is extremely polished and reliable but, it's worth noting, doesn't support access to your email via open standards like IMAP/SMTP without the use of a cumbersome, desktop-only, bridge application.
|
||||
|
|
|
@ -11,7 +11,7 @@ I've used (and/or tried) nearly every email service I've heard of and have stuck
|
|||
|
||||
### Kicking things off
|
||||
|
||||
Register for an account at <a class="plausible-event-name=Fastmail+referral" href="https://ref.fm/u30190984">Fastmail</a>[^3] — you'll be run through their lightweight onboarding process which allows you to select an address at a domain they own or use your own. If you use your own, they'll guide you through configuring the DNS records for it, often with registrar specific instructions.
|
||||
Register for an account at [Fastmail](https://ref.fm/u30190984)[^3] — you'll be run through their lightweight onboarding process which allows you to select an address at a domain they own or use your own. If you use your own, they'll guide you through configuring the DNS records for it, often with registrar specific instructions.
|
||||
|
||||
They also offer [extensive documentation](https://www.fastmail.com/help/domain_management_custom_dns.html) on this process and offer a UI that validates that the records you have set are correct. For example, your finalized records would look like the following:
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ This is most impactful on [my now page](https://coryd.dev/now) which is populate
|
|||
```
|
||||
|
||||
{% endraw %}
|
||||
For this page in particular, the images that are rendered above the fold are set to load as `eager` to mitigate performance impacts related to [too much lazy loading](https://web.dev/lcp-lazy-loading/). These images are fetched from caches hosted at <a class="plausible-event-name=bunny+referral" href="https://bunny.net?ref=revw3mehej">Bunny.net</a> when the site is built.
|
||||
For this page in particular, the images that are rendered above the fold are set to load as `eager` to mitigate performance impacts related to [too much lazy loading](https://web.dev/lcp-lazy-loading/). These images are fetched from caches hosted at [Bunny.net](https://bunny.net?ref=revw3mehej) when the site is built.
|
||||
|
||||
All of these boilerplate steps leave us with a quick to load, accessible and resilient site:
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ These are reasons why I find this all so compelling and some pointers, tips and
|
|||
|
||||
**Register a domain[^1]:**
|
||||
|
||||
I'm partial to <a class="plausible-event-name=DNSimple+referral" href="https://dnsimple.com/r/3a7cbb9e15df8f">DNSimple</a>, but there are many other awesome options like [porkbun](https://porkbun.com) and [hover](https://www.hover.com).
|
||||
I'm partial to [DNSimple](https://dnsimple.com/r/3a7cbb9e15df8f), but there are many other awesome options like [porkbun](https://porkbun.com) and [hover](https://www.hover.com).
|
||||
|
||||
**Choose a blogging service[^2]:**
|
||||
|
||||
|
|
Reference in a new issue