Skip to content

Commit

Permalink
Add tracking script to _app.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tt72 committed Dec 22, 2023
1 parent d4459df commit 72d3b84
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import '../styles/global.css';
import { ShellProvider } from '../utils/shellProvider';
import { ThemeProvider } from '../utils/themeProvider';

const isTrackingEnabled = process.env.NEXT_PUBLIC_ENABLE_TRACKING === 'true';
const trackingUrl = process.env.NEXT_PUBLIC_TRACKING_URL;
const trackingWebsiteId = process.env.NEXT_PUBLIC_TRACKING_SITE_ID;

const App = ({ Component, pageProps }) => {
const inputRef = React.useRef<HTMLInputElement>(null);

Expand All @@ -26,6 +30,14 @@ const App = ({ Component, pageProps }) => {
content="initial-scale=1.0, width=device-width"
key="viewport"
/>

{isTrackingEnabled && (
<script
async
src={trackingUrl}
data-website-id={trackingWebsiteId}
></script>
)}
</Head>

<Layout onClick={onClickAnywhere}>
Expand Down

1 comment on commit 72d3b84

@vercel
Copy link

@vercel vercel bot commented on 72d3b84 Dec 22, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

terminal – ./

terminal-m4tt72.vercel.app
terminal-git-master-m4tt72.vercel.app
term.m4tt72.com

Please sign in to comment.