Google Analytics (gtag)

This commit is contained in:
merelendor 2024-07-18 18:37:35 +03:00
parent 8767d71972
commit 213a7ca783

View File

@ -32,6 +32,19 @@ const WrappedApp = (props) =>
<>
{ !props.observer && (
<>
<Script
src={`https://www.googletagmanager.com/gtag/js?id=${ process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }`}
strategy="afterInteractive"
/>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${ process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }');
`}
</Script>
<Script id="yandex-metrica" strategy={'afterInteractive'}>
{`
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};