Website analytics with Next.js and Plausible.io

I recently wrote an article about adding analytics to your app, which was secretly a gateway to teaching React hooks.

I was using create-react-app, react-router and Google Analytics for the project which inspired that article, but for this week’s project I decided to go with Next.js for the UI / routing, and Plausible.io for the analytics. Why I made different choices for this particular project is a different discussion, feel free to ask and I’ll happily elaborate; but this article is about explaining how I did it… with Typescript support!