From 993c1ddf8a43bcdc7193fa93265110501666b4f2 Mon Sep 17 00:00:00 2001 From: Jonathan Styles Date: Thu, 19 Jun 2025 21:17:11 -0400 Subject: [PATCH 1/3] Added CF tracking --- .gitignore | 1 + app/root.tsx | 19 ++++++++++++++++++- context.ts | 9 ++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d157814..1b4fc46 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .wrangler .DS_Store .env +.dev.vars *.log build node_modules diff --git a/app/root.tsx b/app/root.tsx index f9327a7..6560b00 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -1,4 +1,4 @@ -import type { MetaFunction } from '@remix-run/cloudflare'; +import type { LoaderFunctionArgs, MetaFunction } from '@remix-run/cloudflare'; import { Links, Meta, @@ -6,6 +6,7 @@ import { Scripts, ScrollRestoration, isRouteErrorResponse, + useLoaderData, useRouteError, } from '@remix-run/react'; @@ -20,6 +21,12 @@ import { import './globals.css'; +export const loader = async ({ context }: LoaderFunctionArgs) => { + return { + analyticsToken: context.CLOUDFLARE_ANALYTICS_TOKEN || null, + }; +}; + export const meta: MetaFunction = ({ error, location }) => { const title = 'Hack@UCF - UCF Collegiate Cyber Defense Club'; const defaultDescription = @@ -53,12 +60,22 @@ export const meta: MetaFunction = ({ error, location }) => { }; function App({ children }: { children: React.ReactNode }) { + const { analyticsToken } = useLoaderData(); + return ( + {/* Cloudflare Web Analytics */} + {analyticsToken && ( +