Skip to content

Commit

Permalink
add GA event to paper promotion banner
Browse files Browse the repository at this point in the history
  • Loading branch information
joshslee committed Aug 3, 2020
1 parent fdc5f33 commit 9f3e974
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion components/Banner/PaperPromotionBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,29 @@ class PaperPromotionBanner extends React.Component {
}
};

sendGAEvent = () => {
let payload = {
category: "Paper Promotion Banner",
action: "Click",
label: `Click`,
value: 1,
utc: new Date(),
};

// send first event
fetch(API.GOOGLE_ANALYTICS({ manual: true }), API.POST_CONFIG(payload))
.then(Helpers.checkStatus)
.then(Helpers.parseJSON)
.then((res) => {})
.catch((err) => {});
};

render() {
const { showBanner, transition } = this.state;

return (
<Link href={"/paper/[paperId]/[tabName]"} as={`/paper/819434/summary`}>
<a className={css(styles.removeFormat)}>
<a className={css(styles.removeFormat)} onClick={this.sendGAEvent}>
<div
className={css(
styles.bannerContainer,
Expand Down

0 comments on commit 9f3e974

Please sign in to comment.