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:
21
web/src/components/OutBound/OutBound.js
Normal file
21
web/src/components/OutBound/OutBound.js
Normal 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
|
||||
7
web/src/components/OutBound/OutBound.stories.js
Normal file
7
web/src/components/OutBound/OutBound.stories.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import OutBound from './OutBound'
|
||||
|
||||
export const generated = () => {
|
||||
return <OutBound />
|
||||
}
|
||||
|
||||
export default { title: 'Components/OutBound' }
|
||||
11
web/src/components/OutBound/OutBound.test.js
Normal file
11
web/src/components/OutBound/OutBound.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
|
||||
import OutBound from './OutBound'
|
||||
|
||||
describe('OutBound', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<OutBound />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user