Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit d78ebc5

Browse files
committed
refactor: check Vercel env for rendering plausible
1 parent d0dc1d9 commit d78ebc5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

frontend/src/pages/_app.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { ReactNode } from 'react';
22
import Head from 'next/head';
33
import { appWithTranslation } from 'next-i18next';
44
import { ChakraProvider } from '@chakra-ui/react';
@@ -13,6 +13,14 @@ import PlausibleProvider from 'next-plausible';
1313

1414
const socialBanner = `${DEVELOPER_DAO_WEBSITE}/social-banner.png`;
1515

16+
const Plausible = ({ children }: { children: ReactNode }) => {
17+
return process.env.NEXT_PUBLIC_VERCEL_ENV === 'production' ? (
18+
<PlausibleProvider domain="developerdao.com">{children}</PlausibleProvider>
19+
) : (
20+
<>{children}</>
21+
);
22+
};
23+
1624
function SEO() {
1725
const { t } = useTranslation();
1826

@@ -135,11 +143,11 @@ user's mobile device or desktop. See https://developers.google.com/web/fundament
135143
const App = ({ Component, pageProps }: AppProps) => (
136144
<>
137145
<SEO />
138-
<PlausibleProvider domain="developerdao.com">
146+
<Plausible>
139147
<ChakraProvider theme={theme}>
140148
<Component {...pageProps} />
141149
</ChakraProvider>
142-
</PlausibleProvider>
150+
</Plausible>
143151
</>
144152
);
145153

0 commit comments

Comments
 (0)