File tree Expand file tree Collapse file tree 6 files changed +75
-0
lines changed Expand file tree Collapse file tree 6 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 16
16
"react" : " 17.0.2" ,
17
17
"react-dom" : " 17.0.2" ,
18
18
"react-feather" : " ^2.0.10" ,
19
+ "react-ga" : " ^3.3.1" ,
19
20
"react-parallax" : " ^3.5.1" ,
20
21
"styled-components" : " ^5.3.5" ,
21
22
"uuid" : " ^9.0.0"
Original file line number Diff line number Diff line change
1
+ import { useEffect } from 'react' ;
1
2
import Head from 'next/head' ;
2
3
import Footer from '@/components/common/Footer' ;
3
4
import Header from '@/components//common/Header' ;
4
5
import Site from '@/components/common/Site' ;
5
6
import '@/styles/globals.css' ;
7
+ import { initGA , logPageView } from '@/utils/analytics' ;
6
8
7
9
function MyApp ( { Component, pageProps } ) {
10
+ useEffect ( ( ) => {
11
+ if ( ! window . GA_INITIALIZED ) {
12
+ initGA ( ) ;
13
+ window . GA_INITIALIZED = true ;
14
+ }
15
+ logPageView ( ) ;
16
+
17
+ const appHeight = ( ) => {
18
+ const doc = document . documentElement ;
19
+ doc . style . setProperty ( '--app-height' , `${ window . innerHeight } px` ) ;
20
+ } ;
21
+
22
+ window . addEventListener ( 'resize' , appHeight ) ;
23
+
24
+ appHeight ( ) ;
25
+ } , [ ] ) ;
26
+
8
27
return (
9
28
< Site >
10
29
< Head >
Original file line number Diff line number Diff line change @@ -34,6 +34,35 @@ export default class MyDocument extends Document {
34
34
< Head >
35
35
< meta charset = "utf-8" />
36
36
< meta name = "apple-mobile-web-app-capable" content = "yes" > </ meta >
37
+ < meta
38
+ property = "og:title"
39
+ content = "The Portfolio of Austin Condiff - UX/UI Designer & Developer"
40
+ > </ meta >
41
+ < meta
42
+ property = "og:image"
43
+ content = "http://codeedit.app/assets/social-preview.jpg"
44
+ > </ meta >
45
+ < meta
46
+ property = "og:description"
47
+ content = "I design and develop beautiful yet functional interactive user experiences that provide both customer value and product success."
48
+ > </ meta >
49
+ < meta property = "og:url" content = "http://codeedit.app" > </ meta >
50
+ < meta
51
+ name = "twitter:image"
52
+ content = "https://codeedit.app/assets/social-preview.jpg"
53
+ > </ meta >
54
+ < meta
55
+ name = "twitter:image:src"
56
+ content = "https://codeedit.app/assets/social-preview.jpg"
57
+ > </ meta >
58
+ < meta name = "twitter:card" content = "summary_large_image" > </ meta >
59
+ < meta name = "twitter:site" content = "@CodeEditApp" > </ meta >
60
+ < meta name = "twitter:creator" content = "@CodeEditApp" > </ meta >
61
+ < meta name = "twitter:title" content = "CodeEdit for macOS" > </ meta >
62
+ < meta
63
+ name = "twitter:description"
64
+ content = "CodeEdit, a lightweight, natively built editor for macOS. Open source. Free forever."
65
+ > </ meta >
37
66
< link rel = "icon" href = "/favicon.svg" type = "image/svg+xml" />
38
67
</ Head >
39
68
< body >
Original file line number Diff line number Diff line change
1
+ import ReactGA from 'react-ga' ;
2
+
3
+ export const initGA = ( ) => {
4
+ console . log ( 'GA init' ) ;
5
+ ReactGA . initialize ( 'G-14NVNPBGNR' ) ;
6
+ } ;
7
+ export const logPageView = ( ) => {
8
+ console . log ( `Logging pageview for ${ window . location . pathname } ` ) ;
9
+ ReactGA . set ( { page : window . location . pathname } ) ;
10
+ ReactGA . pageview ( window . location . pathname ) ;
11
+ } ;
12
+ export const logEvent = ( category = '' , action = '' ) => {
13
+ if ( category && action ) {
14
+ ReactGA . event ( { category, action } ) ;
15
+ }
16
+ } ;
17
+ export const logException = ( description = '' , fatal = false ) => {
18
+ if ( description ) {
19
+ ReactGA . exception ( { description, fatal } ) ;
20
+ }
21
+ } ;
Original file line number Diff line number Diff line change @@ -2956,6 +2956,11 @@ react-feather@^2.0.10:
2956
2956
dependencies :
2957
2957
prop-types "^15.7.2"
2958
2958
2959
+ react-ga@^3.3.1 :
2960
+ version "3.3.1"
2961
+ resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.3.1.tgz#d8e1f4e05ec55ed6ff944dcb14b99011dfaf9504"
2962
+ integrity sha512-4Vc0W5EvXAXUN/wWyxvsAKDLLgtJ3oLmhYYssx+YzphJpejtOst6cbIHCIyF50Fdxuf5DDKqRYny24yJ2y7GFQ==
2963
+
2959
2964
react-is@^16.13.1, react-is@^16.7.0 :
2960
2965
version "16.13.1"
2961
2966
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
You can’t perform that action at this time.
0 commit comments