fix analytics

This commit is contained in:
AykutSarac 2022-04-12 12:27:24 +03:00
parent 37e5d105c4
commit f46b2cccdc
2 changed files with 17 additions and 23 deletions

View File

@ -1,22 +0,0 @@
import React from "react";
export const GoogleAnalytics: React.FC = () => {
return (
<>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-JKZEHMJBMH"
/>
<script
dangerouslySetInnerHTML={{
__html: `window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-JKZEHMJBMH');
`,
}}
/>
</>
);
};

View File

@ -42,7 +42,23 @@ class MyDocument extends Document {
return ( return (
<Html lang="en"> <Html lang="en">
<Head> <Head>
{!isDevelopment && <GoogleAnalytics />} {!isDevelopment && (
<>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-JKZEHMJBMH"
/>
<script
dangerouslySetInnerHTML={{
__html: `window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-JKZEHMJBMH');
`,
}}
/>
</>
)}
<SeoTags <SeoTags
description="Simple visualization tool for your JSON data. No forced structure, paste your JSON and view it instantly." description="Simple visualization tool for your JSON data. No forced structure, paste your JSON and view it instantly."
title="JSON Visio" title="JSON Visio"