issue-124 add google analytics

using react-ga which only passively maintained atm, and doesn't support
GA-4, so might have to revisit this at some point.
This commit is contained in:
Kurt Hutten
2020-11-29 18:07:05 +11:00
parent 6632881310
commit 1d1ce874b2
8 changed files with 101 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
import ReactGA from 'react-ga'
const OutBound = ({ className, children, to }) => {
return (
<a
className={className}
href={to}
onClick={() => {
ReactGA.event({
category: 'outbound',
action: to,
})
return true
}}
>
{children}
</a>
)
}
export default OutBound

View File

@@ -0,0 +1,7 @@
import OutBound from './OutBound'
export const generated = () => {
return <OutBound />
}
export default { title: 'Components/OutBound' }

View File

@@ -0,0 +1,11 @@
import { render } from '@redwoodjs/testing'
import OutBound from './OutBound'
describe('OutBound', () => {
it('renders successfully', () => {
expect(() => {
render(<OutBound />)
}).not.toThrow()
})
})