Skip to content

Commit

Permalink
Fixed tracking script loading locally. (#159)
Browse files Browse the repository at this point in the history
Resolves #147
  • Loading branch information
wrux committed Jun 23, 2023
1 parent 94b33ab commit cc61fb4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import '~/styles/main.css';
import { Inter } from 'next/font/google';
import Script from 'next/script';

const env = process.env.NODE_ENV || 'dev';

const sans = Inter({
variable: '--font-sans',
subsets: ['latin'],
Expand All @@ -17,12 +19,14 @@ export default function RootLayout({
return (
<html lang="en-GB" className={`${sans.variable}`} suppressHydrationWarning>
<body>{children}</body>
<Script
src="/stats/js/script.js"
strategy="afterInteractive"
data-api="/stats/api/event"
data-domain="callum.co.uk"
/>
{env === 'production' && (
<Script
src="/stats/js/script.js"
strategy="afterInteractive"
data-api="/stats/api/event"
data-domain="callum.co.uk"
/>
)}
</html>
);
}

1 comment on commit cc61fb4

@vercel
Copy link

@vercel vercel bot commented on cc61fb4 Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.