Skip to content

Commit d6f89df

Browse files
committed
Update event tracking
1 parent ff23cac commit d6f89df

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/components/Nav/Nav.component.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { Link } from 'gatsby'
33
import PropTypes from 'prop-types'
4-
import { OutboundLink } from "gatsby-plugin-google-analytics"
4+
import { trackCustomEvent } from "gatsby-plugin-google-analytics"
55
import {
66
NavWrap,
77
StyledNav,
@@ -68,14 +68,21 @@ const Nav = ({ navOpen, setNavOpen }) => {
6868
<div>
6969
<p>Join the CodeHelp Discord server?</p>
7070
<div>
71-
<OutboundLink
71+
<a
7272
href="https://discord.gg/KntFa9p"
7373
rel="noreferrer noopener"
7474
target="_blank"
7575
title="Join CodeHelp Discord!"
76+
onClick={() => {
77+
trackCustomEvent({
78+
category: "Discord Link",
79+
action: "Click",
80+
label: "Navigation",
81+
})
82+
}}
7683
>
7784
Yes
78-
</OutboundLink>
85+
</a>
7986
<button onClick={() => close()} tabIndex="0">
8087
No
8188
</button>

src/pages/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Layout from '../components/Layout'
44
import Seo from '../components/Seo'
55
import { StyledHome } from '../assets/styles/pages/Index.styles'
66
import discordIcon from '../assets/images/icon-discord.svg'
7-
import { OutboundLink } from "gatsby-plugin-google-analytics"
7+
import { trackCustomEvent } from "gatsby-plugin-google-analytics"
88

99
const IndexPage = () => (
1010
<Layout>
@@ -28,18 +28,25 @@ const IndexPage = () => (
2828
fun, helpful group where people can get the development and programming
2929
support they need.
3030
</p>
31-
<OutboundLink
31+
<a
3232
className="button"
3333
href="https://discord.gg/KntFa9p"
3434
rel="noreferrer noopener"
3535
target="_blank"
3636
title="Join CodeHelp Discord!"
37+
onClick={() => {
38+
trackCustomEvent({
39+
category: "Discord Link",
40+
action: "Click",
41+
label: "Home",
42+
})
43+
}}
3744
>
3845
<span>
3946
<img alt="Discord Icon" src={discordIcon} />
4047
Join CodeHelp
4148
</span>
42-
</OutboundLink>
49+
</a>
4350
</StyledHome>
4451
</Layout>
4552
)

0 commit comments

Comments
 (0)