Skip to content

Commit

Permalink
Fixed Google Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Nov 23, 2020
1 parent a48a928 commit a62196e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
38 changes: 20 additions & 18 deletions src/page-elements/shared-head.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import React from "react";
import { Helmet } from "react-helmet";
import favicon from "../img/favicon.ico";

const gaScript = `
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-19276564-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
`;

export default function SharedHead(): JSX.Element {
return (
<>
<Helmet>
<link rel="icon" href={favicon} />
<script type="text/javascript">
{`
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-19276564-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();`}
</script>
</>
<script>{gaScript}</script>
</Helmet>
);
}
4 changes: 1 addition & 3 deletions src/pages/help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ import HelpPage from "../page-elements/help-page";
import { Helmet } from "react-helmet";
import dynamic from "../lib/dynamic";
import SharedHead from "../page-elements/shared-head";
import FavIcon from "../img/favicon.ico";

export default function Help(): JSX.Element {
return (
<>
{dynamic(() => (
<HelpPage />
))}
<SharedHead />
<Helmet>
<title>Help - Netspeak</title>
<link rel="icon" href={FavIcon}></link>
<SharedHead />
</Helmet>
</>
);
Expand Down
4 changes: 1 addition & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ import SearchPage from "../page-elements/search-page";
import { Helmet } from "react-helmet";
import dynamic from "../lib/dynamic";
import SharedHead from "../page-elements/shared-head";
import FavIcon from "../img/favicon.ico";

export default function Home(): JSX.Element {
return (
<>
{dynamic(() => (
<SearchPage />
))}
<SharedHead />
<Helmet>
<title>Netspeak</title>
<link rel="icon" href={FavIcon}></link>
<meta
name="keywords"
content="netspeak, common language, dictionary, phrase dictionary, netfreak, net speak, net-speak, net slang, internet slang, net-speak, writing assistant"
Expand All @@ -22,7 +21,6 @@ export default function Home(): JSX.Element {
name="description"
content="Netspeak helps you to search for words you don't know, yet. It is a new kind of dictionary that contains everything that has ever been written on the web."
/>
<SharedHead />
</Helmet>
</>
);
Expand Down

0 comments on commit a62196e

Please sign in to comment.