Skip to content

Instantly share code, notes, and snippets.

@EdwinGuzman
Last active December 6, 2016 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwinGuzman/dbad3764f2a4604f933f85b4d0613db6 to your computer and use it in GitHub Desktop.
Save EdwinGuzman/dbad3764f2a4604f933f85b4d0613db6 to your computer and use it in GitHub Desktop.
// In the New Arrivals app, code reduced for brevity
// utils.js
import { gaUtils } from 'dgx-react-ga';
const trackNewArrivals = gaUtils.trackEvent('New Arrivals');
export default { trackNewArrivals };
// The `trackNewArrivals` function can now be used throughout the app wherever
// utils.js is imported and will track every event with a 'New Arrivals' category.
// app.jsx
trackNewArrivals({ action: 'click', label: 'list view' });
trackNewArrivals({ action: 'click', label: 'grid view' });
/* -------------------------------------------------------- */
// In the Staff Picks app, code reduced for brevity
// utils.js
import { gaUtils } from 'dgx-react-ga';
const trackStaffPicks = gaUtils.trackEvent('Staff Picks');
export default { trackStaffPicks };
// The `trackStaffPicks` function can now be used throughout the app wherever
// utils.js is imported and will track every event with a 'Staff Picks' category.
// app.jsx
trackStaffPicks({ action: 'click', label: 'open modal' });
trackStaffPicks({ action: 'click', label: 'close modal' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment