File tree Expand file tree Collapse file tree 8 files changed +55
-0
lines changed
src/components/2_molecules Expand file tree Collapse file tree 8 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 33
33
"react" : " ^16.7.0" ,
34
34
"react-clipboard.js" : " ^2.0.7" ,
35
35
"react-dom" : " ^16.7.0" ,
36
+ "react-ga" : " ^3.1.2" ,
36
37
"react-helmet" : " ^5.2.0" ,
37
38
"react-markdown" : " ^4.0.8" ,
38
39
"react-select" : " ^2.4.2" ,
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
+ import { Event } from "../tracking" ;
2
3
3
4
const styles = {
4
5
color : '#ffffff'
@@ -12,6 +13,9 @@ const CommunityFeaturedNav = () => (
12
13
className = "c-featured"
13
14
href = "https://www.linode.com/marketplace/apps/linode/nextcloud/"
14
15
style = { styles }
16
+ onClick = { ( ) =>
17
+ Event ( 'Navigation' , 'click' , 'nextcloud' )
18
+ }
15
19
>
16
20
< img
17
21
width = "632"
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
+ import { Event } from "../tracking" ;
3
+
2
4
const styles = {
3
5
borderWidth : 2 ,
4
6
borderColor : '#ededf4'
@@ -12,6 +14,9 @@ const PricingFeaturedNav = () => (
12
14
className = "c-featured"
13
15
href = "https://www.linode.com/lp/tco-calculator/"
14
16
style = { styles }
17
+ onClick = { ( ) =>
18
+ Event ( 'Navigation' , 'click' , 'TCO' )
19
+ }
15
20
>
16
21
< img
17
22
width = "416"
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import { StaticQuery , graphql } from "gatsby" ;
3
+ import { PageView , initGA } from "../tracking" ;
3
4
4
5
class MainSiteNav extends React . Component {
5
6
constructor ( props ) {
@@ -27,6 +28,9 @@ class MainSiteNav extends React.Component {
27
28
const header = document . getElementById ( "menu-header-primary" ) ;
28
29
const mobileMenu = document . getElementById ( "o-menu__link--mobile" ) ;
29
30
31
+ initGA ( [ 'UA-177150-1' , 'UA-177150-30' ] ) ;
32
+ PageView ( ) ;
33
+
30
34
const hideAll = ( ) => {
31
35
Object . keys ( subMenus ) . map ( d => {
32
36
const em = subMenus [ d ] ;
@@ -79,6 +83,7 @@ class MainSiteNav extends React.Component {
79
83
} ) ;
80
84
}
81
85
86
+
82
87
header . addEventListener ( "click" , e => {
83
88
const otherMenus = document . getElementsByClassName ( "c-sub-menu" ) ;
84
89
const target = e . target . getAttribute ( "data-submenu" ) ;
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
+ import { Event } from "../tracking" ;
3
+
2
4
const styles1 = {
3
5
borderWidth : 2 ,
4
6
borderColor : '#ededf4'
@@ -20,6 +22,9 @@ const ProductsFeaturedNav = () => (
20
22
className = "c-featured"
21
23
href = "https://www.linode.com/products/gpu/"
22
24
style = { styles1 }
25
+ onClick = { ( ) =>
26
+ Event ( 'Navigation' , 'click' , 'gpus-mumbai' )
27
+ }
23
28
>
24
29
< img
25
30
width = "400"
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
+ import { Event } from "../tracking" ;
2
3
3
4
const styles = {
4
5
color : '#ffffff'
@@ -12,6 +13,9 @@ const WhyFeaturedNav = () => (
12
13
className = "c-featured"
13
14
href = "https://www.linode.com/spotlight/cloudnet/"
14
15
style = { styles }
16
+ onClick = { ( ) =>
17
+ Event ( 'Navigation' , 'click' , 'cloudnet' )
18
+ }
15
19
>
16
20
< img
17
21
width = "632"
Original file line number Diff line number Diff line change
1
+ import ReactGA from "react-ga" ;
2
+
3
+ export const initGA = ( trackingIDs ) => {
4
+ { trackingIDs . map ( id => (
5
+ ReactGA . initialize ( id )
6
+ ) ) }
7
+ }
8
+
9
+ export const PageView = ( ) => {
10
+ ReactGA . pageview ( window . location . pathname +
11
+ window . location . search ) ;
12
+ }
13
+
14
+ /**
15
+ * Event - Add custom tracking event.
16
+ * @param {string } category
17
+ * @param {string } action
18
+ * @param {string } label
19
+ */
20
+ export const Event = ( category , action , label ) => {
21
+ ReactGA . event ( {
22
+ category : category ,
23
+ action : action ,
24
+ label : label
25
+ } ) ;
26
+ } ;
Original file line number Diff line number Diff line change @@ -13608,6 +13608,11 @@ react-frame-component@^4.1.0:
13608
13608
resolved "https://registry.yarnpkg.com/react-frame-component/-/react-frame-component-4.1.0.tgz#bef04039c6af687314f27b20ef9893d85eefe3e6"
13609
13609
integrity sha512-2HkO0iccSjd+xRA+aOxq7Mm50WUmCjdmhbQhOiG6gQTChaW//Y3mdkGeUfVA3YkXvDVbigRDvJd/VTUlqaZWSw==
13610
13610
13611
+ react-ga@^3.1.2:
13612
+ version "3.1.2"
13613
+ resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.1.2.tgz#e13f211c51a2e5c401ea69cf094b9501fe3c51ce"
13614
+ integrity sha512-OJrMqaHEHbodm+XsnjA6ISBEHTwvpFrxco65mctzl/v3CASMSLSyUkFqz9yYrPDKGBUfNQzKCjuMJwctjlWBbw==
13615
+
13611
13616
react-helmet@^5.2.0:
13612
13617
version "5.2.1"
13613
13618
resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-5.2.1.tgz#16a7192fdd09951f8e0fe22ffccbf9bb3e591ffa"
You can’t perform that action at this time.
0 commit comments