evangillespie / monsterCards

Creature statistics for D&D 5e
http://monstercards.ca
MIT License
2 stars 0 forks source link

Track Favourites in Google Analytics #34

Closed cawlin closed 6 years ago

cawlin commented 6 years ago

Sending events seems pretty simple. Here's Google's documentation: https://developers.google.com/analytics/devguides/collection/analyticsjs/events

I propose we create an Event Category of "Favourites" and start by simply recording when someone "adds" a new favourite and when someone "removes" a favourite. We send an event every time someone clicks a star:

Add Event:

ga('send', {
  hitType: 'event',
  eventCategory: 'Favourites',
  eventAction: 'add',
  eventLabel: 'Monster Name'
});

Remove Event

ga('send', {
  hitType: 'event',
  eventCategory: 'Favourites',
  eventAction: 'remove',
  eventLabel: 'Monster Name'
});

The event Label ("Monster Name") would actually be the name of the monster being added or removed Ie. <%= @monster.name %>