From ae542cca8b7923c894f6822d7d12c64cf5757f0a Mon Sep 17 00:00:00 2001
From: Luke Bunselmeyer <luke@bunselmeyer.net>
Date: Mon, 8 May 2023 18:20:17 -0400
Subject: [PATCH] Instrumented custom plausible event to track station plays.

---
 app/components/stations-gallery.tsx | 3 ++-
 app/root.tsx                        | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/components/stations-gallery.tsx b/app/components/stations-gallery.tsx
index 0d3739d..5e3461f 100644
--- a/app/components/stations-gallery.tsx
+++ b/app/components/stations-gallery.tsx
@@ -37,7 +37,8 @@ export function StationsGallery({ stations, tag }: StationsGalleryProps) {
                             </h2>
                             <p>{station.description}</p>
                             <div className="card-actions justify-end">
-                                <Link to={getStationUrl(station.id)} className="btn btn-primary gap-2">
+                                <Link to={getStationUrl(station.id)}
+                                      className={`btn btn-primary gap-2 plausible-event-name=play-station plausible-event-station=${station.slug}`}>
                                     <PlayIcon className="h-6 w-6" />
                                     Listen Now
                                 </Link>
diff --git a/app/root.tsx b/app/root.tsx
index 647df6c..0929744 100644
--- a/app/root.tsx
+++ b/app/root.tsx
@@ -35,7 +35,8 @@ export function Document({ title, children }: DocumentProps) {
             {title ? <title>{title}</title> : null}
             <Meta />
             <Links />
-            <script defer data-domain="awesome-radio-1ae3.fly.dev" src="https://plausible.io/js/script.js"></script>
+            <script defer data-domain="awesome-radio-1ae3.fly.dev"
+                    src="https://plausible.io/js/script.tagged-events.js"></script>
         </head>
         <body className="h-full">
         {children}