rm google analytics tracker
This commit is contained in:
1 parent
a47142944b
commit
d70d8a8a7a
2 files changed
-31
No files matched your search
@@ -8,7 +8,6 @@ import App from "next/app"
|
||||
import Head from "next/head"
|
||||
import Script from "next/script"
|
||||
import { YMetrika } from "src/components/YMetrika"
|
||||
import { GAnalytics } from "src/components/GAnalytics"
|
||||
import { Theme } from "@/ui/theme/Theme"
|
||||
import { ThemeColor } from "@/ui/ThemeColor"
|
||||
|
||||
@@ -44,7 +43,6 @@ export default class MyApp extends App {
|
||||
/>
|
||||
|
||||
<YMetrika account={24027460} />
|
||||
<GAnalytics account={"UA-60209057-1"} />
|
||||
|
||||
<ThemeColor
|
||||
color="white"
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import React from "react"
|
||||
|
||||
function script(account) {
|
||||
return `
|
||||
if (window.location.host.indexOf('localhost') === -1) {
|
||||
(function (window, document, script, src, ga, element, m) {
|
||||
window['GoogleAnalyticsObject'] = ga;
|
||||
if (!window[ga]) {
|
||||
window[ga] = function () {
|
||||
(window[ga].q = window[ga].q || []).push(arguments)
|
||||
}
|
||||
}
|
||||
window[ga].l = 1 * new Date();
|
||||
element = document.createElement(script);
|
||||
m = document.getElementsByTagName(script)[0];
|
||||
element.async = 1;
|
||||
element.src = src;
|
||||
m.parentNode.insertBefore(element, m)
|
||||
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga('create', '${account}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const GAnalytics = (props) => (
|
||||
<script dangerouslySetInnerHTML={{ __html: script(props.account) }} />
|
||||
)
|
||||
Reference in new issue
Block a user