diff --git a/packages/gatsby-plugin-google-analytics/src/index.js b/packages/gatsby-plugin-google-analytics/src/index.js index a1bbe085042be..6ec1888d1a845 100644 --- a/packages/gatsby-plugin-google-analytics/src/index.js +++ b/packages/gatsby-plugin-google-analytics/src/index.js @@ -6,6 +6,9 @@ function OutboundLink(props) { { + if (typeof props.onClick === `function`) { + props.onClick() + } let redirect = true if ( e.button !== 0 || @@ -47,6 +50,7 @@ function OutboundLink(props) { OutboundLink.propTypes = { href: PropTypes.string, target: PropTypes.string, + onClick: PropTypes.func, } export { OutboundLink }