|
@@ -8,15 +8,15 @@ define [
|
|
|
ga('send', 'event', category, action)
|
|
ga('send', 'event', category, action)
|
|
|
event_name = "#{action}-#{category}"
|
|
event_name = "#{action}-#{category}"
|
|
|
Intercom?("trackEvent", event_name, attributes)
|
|
Intercom?("trackEvent", event_name, attributes)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
App.factory "event_tracking", ($http, localStorage) ->
|
|
App.factory "event_tracking", ($http, localStorage) ->
|
|
|
- _getEventCache = () ->
|
|
|
|
|
|
|
+ _getEventCache = () ->
|
|
|
eventCache = localStorage CACHE_KEY
|
|
eventCache = localStorage CACHE_KEY
|
|
|
|
|
|
|
|
# Initialize as an empy object if the event cache is still empty.
|
|
# Initialize as an empy object if the event cache is still empty.
|
|
|
if !eventCache?
|
|
if !eventCache?
|
|
|
eventCache = {}
|
|
eventCache = {}
|
|
|
- localStorage CACHE_KEY, eventCache
|
|
|
|
|
|
|
+ localStorage CACHE_KEY, eventCache
|
|
|
|
|
|
|
|
return eventCache
|
|
return eventCache
|
|
|
|
|
|
|
@@ -45,7 +45,7 @@ define [
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sendMBSampled: (key, segmentation) ->
|
|
sendMBSampled: (key, segmentation) ->
|
|
|
- @sendMB key, segmentation if Math.random() < .01
|
|
|
|
|
|
|
+ @sendMB key, segmentation if Math.random() < .01
|
|
|
|
|
|
|
|
sendMBOnce: (key, segmentation) ->
|
|
sendMBOnce: (key, segmentation) ->
|
|
|
if ! _eventInCache(key)
|
|
if ! _eventInCache(key)
|