Skip to content

Commit

Permalink
fix(analytics): Improve ga calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ReedD committed Aug 25, 2018
1 parent b723d4e commit da1d363
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
20 changes: 12 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ const description = "Reed Dadoune's blog and project portfolio";
const App = () => (
<div>
<Head>
<title>{title}</title>
<meta charSet="UTF-8" />
<link rel="canonical" href="https://www.dadoune.com/" />
<link rel="manifest" href="manifest.json" />
<meta name="author" content="Reed Dadoune" />
<meta name="description" content={description} />
<meta name="robots" content="index, follow" />
<meta name="theme-color" content="#ffffff" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:description" content={description} />
<meta property="og:image" content="/icon-512x512.png" />
<meta property="og:site_name" content="Reed Dadoune" />
<meta property="og:title" content={title} />
<meta property="og:type" content="website" />
<link rel="manifest" href="manifest.json" />
<title>Home | dadoune.com</title>
<title>{title}</title>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700"
Expand All @@ -48,12 +54,10 @@ const App = () => (
<Route
path="/"
render={({ location }) => {
if (
typeof window !== 'undefined' &&
typeof window.ga === 'function'
) {
window.ga('set', 'page', location.pathname + location.search);
window.ga('send', 'pageview');
const ga = typeof window !== 'undefined' && (window as any).ga;
if (ga) {
ga('set', 'page', location.pathname + location.search);
ga('send', 'pageview');
}
return null;
}}
Expand Down
9 changes: 0 additions & 9 deletions static.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,6 @@ export default {
return (
<Html>
<Head>
<meta charSet="UTF-8" />
<title>Home | dadoune.com</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
/>
<meta name="author" content="Reed Dadoune" />
<meta name="robots" content="index, follow" />
<link rel="canonical" href="https://dadoune.com/" />
{renderMeta.styleTags}
</Head>
<Body>{children}</Body>
Expand Down

0 comments on commit da1d363

Please sign in to comment.