Last active
December 5, 2016 20:31
-
-
Save EdwinGuzman/8569b878132628362b5f50db0497e40d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App.jsx | |
import HomepageRow from 'dgx-homepage-row-component'; | |
import HomepageStaffPicks from 'dgx-homepage-staff-picks-component'; | |
import { gaUtils } from 'dgx-react-ga'; | |
const trackHomepage = gaUtils.trackEvent('Homepage'); | |
const trackHomepageRow = (action) => { | |
return (label) => { | |
return trackHomepage(action, label); | |
}; | |
}; | |
class App extends React.Component { | |
// ... | |
render () { | |
// ... | |
<HomepageRow trackHomepageRow={trackHomepageRow('Staff Picks')} content={<HomepageStaffPicks />} /> | |
} | |
} | |
// HomepageStaffPicks.jsx | |
// Now we can call the trackHomepageRow function similar to above but only passing the label we want to track for the element: | |
<a href={link} onClick={this.props.trackHomepageRow('Heading')}>Staff Picks</a> | |
// And in the feature component of the Homepagestaffpicks component for a book image: | |
<a href={link} onClick={this.props.trackHomepageRow('book image')}><img … /> </a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment