Skip to content

Commit e4f8e17

Browse files
authored
[FIL-1169] Use plausible instead of GA (#215)
* Use plausible instead of GA
1 parent aee4fe3 commit e4f8e17

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/components/Analytics.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import { config } from '@/config'
55
const Analytics: React.FC = () => {
66
return (
77
<>
8+
{/* Privacy-friendly analytics by Plausible */}
89
<Script
910
async
10-
src={`https://www.googletagmanager.com/gtag/js?id=${config.gaTrackingId}`}
11+
src={`https://plausible.io/js/${config.plausibleTrackingId}.js`}
1112
></Script>
12-
<Script id="ga-script">
13-
{`window.dataLayer = window.dataLayer || [];
14-
function gtag(){dataLayer.push(arguments);}
15-
gtag('js', new Date());
16-
17-
gtag('config', '${config.gaTrackingId}');`}
13+
<Script id="plausible-scrip">
14+
{`
15+
window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
16+
plausible.init()
17+
`}
1818
</Script>
1919
</>
2020
)

src/components/CookieBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const CookieBanner = ({ children }: PropsWithChildren) => {
9393
}}
9494
>
9595
We use cookies to improve your experience and analyze traffic with
96-
Google Analytics. By clicking &quot;Accept&quot; you consent to our
96+
Plausible Analytics. By clicking &quot;Accept&quot; you consent to our
9797
use of cookies.
9898
</CookieConsent>
9999
)}

src/config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ const localConfig = {
2525
glifNodeUrl:
2626
process.env.NEXT_PUBLIC_GLIF_URL ?? 'https://api.node.glif.io/rpc/v1',
2727
isTestnet: process.env.NEXT_PUBLIC_IS_TESTNET ?? 'true',
28-
gaTrackingId: process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID ?? '',
28+
plausibleTrackingId:
29+
process.env.NEXT_PUBLIC_PLAUSIBLE_ANALYTICS_TRACKING_ID ?? '',
2930
filfoxUrl:
3031
process.env.NEXT_PUBLIC_FILFOX_URL ?? 'https://calibration.filfox.info/en',
3132
}
@@ -54,7 +55,8 @@ const prodConfig = {
5455
dmobApiKey: process.env.NEXT_PUBLIC_DMOB_API_KEY ?? '',
5556
glifNodeUrl: process.env.NEXT_PUBLIC_GLIF_URL ?? '',
5657
isTestnet: process.env.NEXT_PUBLIC_IS_TESTNET ?? 'false',
57-
gaTrackingId: process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID ?? '',
58+
plausibleTrackingId:
59+
process.env.NEXT_PUBLIC_PLAUSIBLE_ANALYTICS_TRACKING_ID ?? '',
5860
filfoxUrl: process.env.NEXT_PUBLIC_FILFOX_URL ?? 'https://filfox.info/en',
5961
}
6062

0 commit comments

Comments
 (0)