mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Remove Segment analytics dependency
Call Google Analytics, Errorception, and Inspectlet directly.
This commit is contained in:
parent
f2f1359e3b
commit
86d167394e
19 changed files with 108 additions and 132 deletions
app
|
@ -28,6 +28,39 @@
|
|||
<link rel="shortcut icon" href="/images/favicon.ico">
|
||||
<link rel="stylesheet" href="/stylesheets/app.css">
|
||||
|
||||
<!-- Google Analytics -->
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-39724129-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
<!-- Errorception -->
|
||||
<script>
|
||||
(function(_,e,rr,s){_errs=[s];var c=_.onerror;_.onerror=function(){var a=arguments;_errs.push(a);
|
||||
c&&c.apply(this,a)};var b=function(){var c=e.createElement(rr),b=e.getElementsByTagName(rr)[0];
|
||||
c.src="//beacon.errorception.com/"+s+".js";c.async=!0;b.parentNode.insertBefore(c,b)};
|
||||
_.addEventListener?_.addEventListener("load",b,!1):_.attachEvent("onload",b)})
|
||||
(window,document,"script","51a79585ee207206390002a2");
|
||||
</script>
|
||||
|
||||
<!-- Inspectlet -->
|
||||
<script type="text/javascript" id="inspectletjs">
|
||||
window.__insp = window.__insp || [];
|
||||
__insp.push(['wid', 2102699786]);
|
||||
(function() {
|
||||
function __ldinsp(){var insp = document.createElement('script'); insp.type = 'text/javascript'; insp.async = true; insp.id = "inspsync"; insp.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://cdn.inspectlet.com/inspectlet.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(insp, x); }
|
||||
if (window.attachEvent){
|
||||
window.attachEvent('onload', __ldinsp);
|
||||
}else{
|
||||
window.addEventListener('load', __ldinsp, false);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- IE9 doesn't support defer attribute: https://github.com/h5bp/lazyweb-requests/issues/42 -->
|
||||
<!--[if IE 9]>
|
||||
<script src="/lib/ace/ace.js"></script>
|
||||
|
@ -60,7 +93,7 @@
|
|||
alert("CodeCombat does not run in Internet Explorer 8 or older. Sorry!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IE8 can't handle this
|
||||
FastClick.attach(document.body);
|
||||
require('core/initialize');
|
||||
|
|
|
@ -187,7 +187,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
$("ul.nav li.#{base}").addClass('active')
|
||||
|
||||
_trackPageView: ->
|
||||
window.tracker?.trackPageView null, ['Google Analytics']
|
||||
window.tracker?.trackPageView()
|
||||
|
||||
onNavigate: (e) ->
|
||||
if _.isString e.viewClass
|
||||
|
|
|
@ -13,69 +13,57 @@ module.exports = class Tracker
|
|||
@supermodel = new SuperModel()
|
||||
|
||||
identify: (traits={}) ->
|
||||
return unless me
|
||||
|
||||
# Save explicit traits for internal tracking
|
||||
@explicitTraits ?= {}
|
||||
@explicitTraits[key] = value for key, value of traits
|
||||
|
||||
console.log 'Would identify', traits if debugAnalytics
|
||||
return unless me and @isProduction and analytics? and not me.isAdmin()
|
||||
# https://segment.io/docs/methods/identify
|
||||
for userTrait in ['email', 'anonymous', 'dateCreated', 'name', 'wizardColor1', 'testGroupNumber', 'gender', 'lastLevel']
|
||||
traits[userTrait] ?= me.get(userTrait)
|
||||
analytics.identify me.id, traits
|
||||
console.log 'Would identify', traits if debugAnalytics
|
||||
return unless @isProduction and not me.isAdmin()
|
||||
|
||||
trackPageView: (virtualName=null, includeIntegrations=null) ->
|
||||
# console.log 'trackPageView', virtualName, includeIntegrations
|
||||
# Google Analytics does not support event-based funnels, so we have to use virtual pageviews instead
|
||||
# https://support.google.com/analytics/answer/1032720?hl=en
|
||||
name = virtualName ? Backbone.history.getFragment()
|
||||
# Errorception
|
||||
# https://errorception.com/docs/meta
|
||||
_errs?.meta = traits
|
||||
|
||||
properties = {}
|
||||
if virtualName?
|
||||
# Override title and path properties for virtual page view
|
||||
# https://segment.com/docs/libraries/analytics.js/#page
|
||||
properties =
|
||||
title: name
|
||||
path: "/#{name}"
|
||||
# Inspectlet
|
||||
# https://www.inspectlet.com/docs#identifying_users
|
||||
__insp?.push ['identify', me.id]
|
||||
__insp?.push ['tagSession', traits]
|
||||
|
||||
options = {}
|
||||
if includeIntegrations?
|
||||
options = integrations: {'All': false}
|
||||
for integration in includeIntegrations
|
||||
options.integrations[integration] = true
|
||||
trackPageView: ->
|
||||
name = Backbone.history.getFragment()
|
||||
console.log "Would track analytics pageview: '/#{name}'" if debugAnalytics
|
||||
return unless @isProduction and not me.isAdmin()
|
||||
|
||||
console.log "Would track analytics pageview: '/#{name}'", properties, options, includeIntegrations if debugAnalytics
|
||||
return unless @isProduction and analytics? and not me.isAdmin()
|
||||
# Google Analytics
|
||||
# https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
|
||||
ga? 'send', 'pageview', "/#{name}"
|
||||
|
||||
# Ok to pass empty properties, but maybe not options
|
||||
# TODO: What happens when we pass empty options?
|
||||
if _.isEmpty options
|
||||
# console.log "trackPageView without options '/#{name}'", properties, options
|
||||
analytics.page "/#{name}"
|
||||
else
|
||||
# console.log "trackPageView with options '/#{name}'", properties, options
|
||||
analytics.page "/#{name}", properties, options
|
||||
|
||||
trackEvent: (action, properties, includeIntegrations=null) =>
|
||||
# 'action' is a string
|
||||
# Google Analytics properties format: {category: 'Account', label: 'Premium', value: 50 }
|
||||
# https://segment.com/docs/integrations/google-analytics/#track
|
||||
# https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#Anatomy
|
||||
# Mixpanel properties format: whatever you want unlike GA
|
||||
# https://segment.com/docs/integrations/mixpanel/
|
||||
properties = properties or {}
|
||||
# Inspectlet
|
||||
# http://www.inspectlet.com/docs#virtual_pageviews
|
||||
__insp?.push ['virtualPage']
|
||||
|
||||
trackEvent: (action, properties={}) =>
|
||||
@trackEventInternal action, _.cloneDeep properties unless me?.isAdmin() and @isProduction
|
||||
console.log 'Tracking external analytics event:', action, properties if debugAnalytics
|
||||
return unless me and @isProduction and not me.isAdmin()
|
||||
|
||||
console.log 'Would track analytics event:', action, properties, includeIntegrations if debugAnalytics
|
||||
return unless me and @isProduction and analytics? and not me.isAdmin()
|
||||
context = {}
|
||||
if includeIntegrations
|
||||
# https://segment.com/docs/libraries/analytics.js/#selecting-integrations
|
||||
context.integrations = {'All': false}
|
||||
for integration in includeIntegrations
|
||||
context.integrations[integration] = true
|
||||
analytics?.track action, properties, context
|
||||
# Google Analytics
|
||||
# https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
||||
gaFieldObject =
|
||||
hitType: 'event'
|
||||
eventCategory: properties.category ? 'All'
|
||||
eventAction: action
|
||||
gaFieldObject.eventLabel = properties.label if properties.label?
|
||||
gaFieldObject.eventValue = properties.value if properties.value?
|
||||
ga? 'send', gaFieldObject
|
||||
|
||||
# Inspectlet
|
||||
# http://www.inspectlet.com/docs#tagging
|
||||
__insp?.push ['tagSession', action: action, properies: properties]
|
||||
|
||||
trackEventInternal: (event, properties) =>
|
||||
# Skipping heavily logged actions we don't use internally
|
||||
|
@ -96,7 +84,7 @@ module.exports = class Tracker
|
|||
eventObject["properties"] = properties unless _.isEmpty properties
|
||||
eventObject["user"] = me.id
|
||||
dataToSend = JSON.stringify eventObject
|
||||
console.log dataToSend if debugAnalytics
|
||||
# console.log dataToSend if debugAnalytics
|
||||
$.post("http://analytics.codecombat.com/analytics", dataToSend).fail ->
|
||||
console.error "Analytics post failed!"
|
||||
else
|
||||
|
@ -107,8 +95,9 @@ module.exports = class Tracker
|
|||
}, 0
|
||||
request.load()
|
||||
|
||||
trackTiming: (duration, category, variable, label, samplePercentage=5) ->
|
||||
# https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingTiming
|
||||
trackTiming: (duration, category, variable, label) ->
|
||||
# https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings
|
||||
return console.warn "Duration #{duration} invalid for trackTiming call." unless duration >= 0 and duration < 60 * 60 * 1000
|
||||
console.log 'Would track timing event:', arguments if debugAnalytics
|
||||
window._gaq?.push ['_trackTiming', category, variable, duration, label, samplePercentage]
|
||||
return unless me and @isProduction and not me.isAdmin()
|
||||
ga? 'send', 'timing', category, variable, duration, label
|
||||
|
|
|
@ -35,7 +35,6 @@ init = ->
|
|||
path = document.location.pathname
|
||||
app.testing = _.string.startsWith path, '/test'
|
||||
app.demoing = _.string.startsWith path, '/demo'
|
||||
initializeUtilityServices() unless app.testing or app.demoing
|
||||
setUpBackboneMediator()
|
||||
app.initialize()
|
||||
Backbone.history.start({ pushState: true })
|
||||
|
@ -83,9 +82,6 @@ setUpMoment = ->
|
|||
me.on 'change:preferredLanguage', (me) ->
|
||||
moment.lang me.get('preferredLanguage', true), {}
|
||||
|
||||
initializeUtilityServices = ->
|
||||
require('core/services/segmentio')()
|
||||
|
||||
setupConsoleLogging = ->
|
||||
# IE9 doesn't expose console object unless debugger tools are loaded
|
||||
unless console?
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
module.exports = initializeSegmentio = ->
|
||||
analytics = analytics or []
|
||||
(->
|
||||
e = [
|
||||
'identify'
|
||||
'track'
|
||||
'trackLink'
|
||||
'trackForm'
|
||||
'trackClick'
|
||||
'trackSubmit'
|
||||
'page'
|
||||
'pageview'
|
||||
'ab'
|
||||
'alias'
|
||||
'ready'
|
||||
'group'
|
||||
]
|
||||
t = (e) ->
|
||||
->
|
||||
analytics.push [e].concat(Array::slice.call(arguments, 0))
|
||||
return
|
||||
|
||||
n = 0
|
||||
|
||||
while n < e.length
|
||||
analytics[e[n]] = t(e[n])
|
||||
n++
|
||||
return
|
||||
)()
|
||||
analytics.load = (e) ->
|
||||
t = document.createElement('script')
|
||||
t.type = 'text/javascript'
|
||||
t.async = not 0
|
||||
t.src = ((if 'https:' is document.location.protocol then 'https://' else 'http://')) + 'd2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/' + e + '/analytics.min.js'
|
||||
|
||||
n = document.getElementsByTagName('script')[0]
|
||||
n.parentNode.insertBefore t, n
|
||||
return
|
||||
|
||||
analytics.load 'jsjzx9n4d2'
|
|
@ -48,7 +48,7 @@ module.exports = FacebookHandler = class FacebookHandler extends CocoClass
|
|||
error: backboneFailure,
|
||||
url: "/db/user/#{me.id}?facebookID=#{r.id}&facebookAccessToken=#{@authResponse.accessToken}"
|
||||
success: (model) ->
|
||||
window.tracker?.trackEvent 'Facebook Login', category: "Signup", ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Facebook Login', category: "Signup", label: 'Facebook'
|
||||
if model.id is beforeID
|
||||
window.tracker?.trackEvent 'Finished Signup', category: "Signup", label: 'Facebook'
|
||||
window.location.reload() if model.get('email') isnt oldEmail
|
||||
|
|
|
@ -102,7 +102,7 @@ module.exports = GPlusHandler = class GPlusHandler extends CocoClass
|
|||
url: "/db/user?gplusID=#{gplusID}&gplusAccessToken=#{@accessToken.access_token}"
|
||||
success: (model) ->
|
||||
console.info('GPLus login success!')
|
||||
window.tracker?.trackEvent 'Google Login', category: "Signup", ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Google Login', category: "Signup"
|
||||
if model.id is beforeID
|
||||
window.tracker?.trackEvent 'Finished Signup', label: 'GPlus'
|
||||
window.location.reload() if wasAnonymous and not model.get('anonymous')
|
||||
|
|
|
@ -98,14 +98,14 @@ module.exports = class LevelSetupManager extends CocoClass
|
|||
@inventoryModal.didReappear()
|
||||
@inventoryModal.onShown()
|
||||
@inventoryModal.setHero(e.hero) if e.hero
|
||||
window.tracker?.trackEvent 'Choose Inventory', category: 'Play Level', ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Choose Inventory', category: 'Play Level'
|
||||
|
||||
onChooseHeroClicked: ->
|
||||
@options.parent.openModalView(@heroesModal)
|
||||
@heroesModal.render()
|
||||
@heroesModal.didReappear()
|
||||
@inventoryModal.endHighlight()
|
||||
window.tracker?.trackEvent 'Change Hero', category: 'Play Level', ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Change Hero', category: 'Play Level'
|
||||
|
||||
onInventoryModalPlayClicked: ->
|
||||
@navigatingToPlay = true
|
||||
|
|
|
@ -130,7 +130,6 @@ module.exports = class User extends CocoModel
|
|||
getVideoTutorialStylesIndex: (numVideos=0)->
|
||||
# A/B Testing video tutorial styles
|
||||
# Not a constant number of videos available (e.g. could be 0, 1, 3, or 4 currently)
|
||||
# TODO: Do we need to call identify() still? trackEvent will have a style property.
|
||||
return 0 unless numVideos > 0
|
||||
return me.get('testGroupNumber') % numVideos
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = class HomeView extends RootView
|
|||
|
||||
constructor: ->
|
||||
super()
|
||||
window.tracker?.trackEvent 'Homepage Loaded', category: 'Homepage', ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Homepage Loaded', category: 'Homepage'
|
||||
if not me.get('hourOfCode') and @getQueryVariable 'hour_of_code'
|
||||
@setUpHourOfCode()
|
||||
elapsed = (new Date() - new Date(me.get('dateCreated')))
|
||||
|
@ -52,4 +52,4 @@ module.exports = class HomeView extends RootView
|
|||
me.patch()
|
||||
# We may also insert the tracking pixel for everyone on the CampaignView so as to count directly-linked visitors.
|
||||
$('body').append($('<img src="http://code.org/api/hour/begin_codecombat.png" style="visibility: hidden;">'))
|
||||
application.tracker?.trackEvent 'Hour of Code Begin', {}
|
||||
application.tracker?.trackEvent 'Hour of Code Begin'
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
'click .profile-photo': 'onEditProfilePhoto'
|
||||
'click #upload-photo-button': 'onEditProfilePhoto'
|
||||
'click #delete-account-button': 'confirmAccountDeletion'
|
||||
|
||||
|
||||
constructor: (options) ->
|
||||
super options
|
||||
require('core/services/filepicker')() unless window.application.isIPadApp # Initialize if needed
|
||||
|
@ -36,13 +36,13 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
c.subs[sub] = 1 for sub in me.getEnabledEmails()
|
||||
c
|
||||
|
||||
|
||||
|
||||
#- Form input callbacks
|
||||
onInputChanged: (e) ->
|
||||
$(e.target).addClass 'changed'
|
||||
if (JSON.stringify(document.getElementById('email1').className)).indexOf("changed") > -1
|
||||
if (JSON.stringify(document.getElementById('email1').className)).indexOf("changed") > -1
|
||||
$(e.target).removeClass 'changed'
|
||||
else
|
||||
else
|
||||
@trigger 'input-changed'
|
||||
|
||||
toggleEmailSubscriptions: =>
|
||||
|
@ -65,9 +65,9 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
@trigger 'inputChanged', e
|
||||
@$el.find('.gravatar-fallback').toggle not me.get 'photoURL'
|
||||
|
||||
|
||||
|
||||
#- Just copied from OptionsView, TODO refactor
|
||||
|
||||
|
||||
confirmAccountDeletion: ->
|
||||
forms.clearFormAlerts(@$el)
|
||||
myEmail = me.get 'email'
|
||||
|
@ -99,7 +99,7 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
layout: 'topCenter'
|
||||
_.delay ->
|
||||
Backbone.Mediator.publish("auth:logging-out", {})
|
||||
window.tracker?.trackEvent 'Log Out', category:'Homepage', ['Google Analytics'] if @id is 'home-view'
|
||||
window.tracker?.trackEvent 'Log Out', category:'Homepage' if @id is 'home-view'
|
||||
logoutUser($('#login-email').val())
|
||||
, 500
|
||||
error: (jqXHR, status, error) ->
|
||||
|
@ -136,8 +136,8 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
onImageUploaded: (onSaved, uploadingPath) ->
|
||||
(e) =>
|
||||
onSaved uploadingPath
|
||||
|
||||
|
||||
|
||||
|
||||
#- Misc
|
||||
|
||||
getSubscriptions: ->
|
||||
|
@ -146,9 +146,9 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
enableds = (i.prop('checked') for i in inputs)
|
||||
_.zipObject emailNames, enableds
|
||||
|
||||
|
||||
|
||||
#- Saving changes
|
||||
|
||||
|
||||
save: ->
|
||||
$('#settings-tabs input').removeClass 'changed'
|
||||
forms.clearFormAlerts(@$el)
|
||||
|
@ -217,4 +217,3 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
permissions.push 'godmode' if godmodeCheckbox.prop('checked')
|
||||
|
||||
me.set('permissions', permissions)
|
||||
|
||||
|
|
|
@ -56,12 +56,12 @@ module.exports = class SubscriptionView extends RootView
|
|||
document.location.reload()
|
||||
|
||||
onClickEndSubscription: (e) ->
|
||||
window.tracker?.trackEvent 'Unsubscribe Start', {}
|
||||
window.tracker?.trackEvent 'Unsubscribe Start'
|
||||
@$el.find('.end-subscription-button').blur().addClass 'disabled', 250
|
||||
@$el.find('.unsubscribe-feedback').show(500).find('textarea').focus()
|
||||
|
||||
onClickCancelEndSubscription: (e) ->
|
||||
window.tracker?.trackEvent 'Unsubscribe Cancel', {}
|
||||
window.tracker?.trackEvent 'Unsubscribe Cancel'
|
||||
@$el.find('.unsubscribe-feedback').hide(500).find('textarea').blur()
|
||||
@$el.find('.end-subscription-button').focus().removeClass 'disabled', 250
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ module.exports = class SubscribeModal extends ModalView
|
|||
content: popoverContent
|
||||
container: @$el
|
||||
).on 'shown.bs.popover', =>
|
||||
application.tracker?.trackEvent 'Subscription ask parent button click', {}
|
||||
application.tracker?.trackEvent 'Subscription ask parent button click'
|
||||
|
||||
setupParentInfoPopover: ->
|
||||
popoverTitle = $.i18n.t 'subscribe.parents_title'
|
||||
|
@ -83,7 +83,7 @@ module.exports = class SubscribeModal extends ModalView
|
|||
content: popoverContent
|
||||
container: @$el
|
||||
).on 'shown.bs.popover', =>
|
||||
application.tracker?.trackEvent 'Subscription parent hover', {}
|
||||
application.tracker?.trackEvent 'Subscription parent hover'
|
||||
|
||||
onClickParentSendButton: (e) ->
|
||||
# TODO: Popover sometimes dismisses immediately after send
|
||||
|
@ -108,7 +108,7 @@ module.exports = class SubscribeModal extends ModalView
|
|||
onClickPurchaseButton: (e) ->
|
||||
@playSound 'menu-button-click'
|
||||
return @openModalView new AuthModal() if me.get('anonymous')
|
||||
application.tracker?.trackEvent 'Started subscription purchase', {}
|
||||
application.tracker?.trackEvent 'Started subscription purchase'
|
||||
options = {
|
||||
description: $.i18n.t('subscribe.stripe_description')
|
||||
amount: @product.amount
|
||||
|
|
|
@ -44,7 +44,7 @@ module.exports = class SimulateTabView extends CocoView
|
|||
# Simulations
|
||||
|
||||
onSimulateButtonClick: (e) ->
|
||||
application.tracker?.trackEvent 'Simulate Button Click', {}
|
||||
application.tracker?.trackEvent 'Simulate Button Click'
|
||||
@startSimulating()
|
||||
|
||||
startSimulating: ->
|
||||
|
|
|
@ -96,7 +96,7 @@ module.exports = class CampaignView extends RootView
|
|||
@listenTo me, 'change:purchased', -> @renderSelectors('#gems-count')
|
||||
@listenTo me, 'change:spent', -> @renderSelectors('#gems-count')
|
||||
@listenTo me, 'change:heroConfig', -> @updateHero()
|
||||
window.tracker?.trackEvent 'Loaded World Map', category: 'World Map', label: @terrain, ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Loaded World Map', category: 'World Map', label: @terrain
|
||||
|
||||
# If it's a new player who didn't appear to come from Hour of Code, we register her here without setting the hourOfCode property.
|
||||
elapsed = (new Date() - new Date(me.get('dateCreated')))
|
||||
|
@ -429,7 +429,7 @@ module.exports = class CampaignView extends RootView
|
|||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'map level clicked', level: levelSlug
|
||||
else
|
||||
@startLevel levelElement
|
||||
window.tracker?.trackEvent 'Clicked Start Level', category: 'World Map', levelID: levelSlug, ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Clicked Start Level', category: 'World Map', levelID: levelSlug
|
||||
|
||||
startLevel: (levelElement) ->
|
||||
@setupManager?.destroy()
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = class LevelDialogueView extends CocoView
|
|||
$('body').addClass('dialogue-view-active')
|
||||
@setMessage e.message, e.mood, e.responses
|
||||
|
||||
window.tracker?.trackEvent 'Heard Sprite', {message: e.message, label: e.message, ls: @sessionID}, ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Heard Sprite', {message: e.message, label: e.message, ls: @sessionID}
|
||||
|
||||
onDialogueSoundCompleted: ->
|
||||
@$el.removeClass 'speaking'
|
||||
|
|
|
@ -110,7 +110,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
setTimeout f, 100
|
||||
else
|
||||
@load()
|
||||
application.tracker?.trackEvent 'Started Level Load', category: 'Play Level', level: @levelID, label: @levelID, ['Google Analytics'] unless @observing
|
||||
application.tracker?.trackEvent 'Started Level Load', category: 'Play Level', level: @levelID, label: @levelID unless @observing
|
||||
|
||||
setLevel: (@level, givenSupermodel) ->
|
||||
@supermodel.models = givenSupermodel.models
|
||||
|
@ -136,7 +136,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
loadDuration = @loadEndTime - @loadStartTime
|
||||
console.debug "Level unveiled after #{(loadDuration / 1000).toFixed(2)}s"
|
||||
unless @observing
|
||||
application.tracker?.trackEvent 'Finished Level Load', category: 'Play Level', label: @levelID, level: @levelID, loadDuration: loadDuration, ['Google Analytics']
|
||||
application.tracker?.trackEvent 'Finished Level Load', category: 'Play Level', label: @levelID, level: @levelID, loadDuration: loadDuration
|
||||
application.tracker?.trackTiming loadDuration, 'Level Load Time', @levelID, @levelID
|
||||
|
||||
# CocoView overridden methods ###############################################
|
||||
|
@ -430,7 +430,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
label: @level.get('name')
|
||||
levelID: @levelID
|
||||
ls: @session?.get('_id')
|
||||
application.tracker?.trackTiming victoryTime, 'Level Victory Time', @levelID, @levelID, 100
|
||||
application.tracker?.trackTiming victoryTime, 'Level Victory Time', @levelID, @levelID
|
||||
|
||||
showVictory: ->
|
||||
@endHighlight()
|
||||
|
|
|
@ -146,7 +146,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
|||
$('body').append($('<img src="http://code.org/api/hour/finish_codecombat.png" style="visibility: hidden;">'))
|
||||
me.set 'hourOfCodeComplete', true # Note that this will track even for players who don't have hourOfCode set.
|
||||
me.patch()
|
||||
window.tracker?.trackEvent 'Hour of Code Finish', {}
|
||||
window.tracker?.trackEvent 'Hour of Code Finish'
|
||||
# Show the "I'm done" button between 30 - 120 minutes if they definitely came from Hour of Code
|
||||
c.showHourOfCodeDoneButton = me.get('hourOfCode') and showDone
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ module.exports = class InventoryModal extends ModalView
|
|||
hasGoneFullScreenOnce = true
|
||||
@updateConfig =>
|
||||
@trigger? 'play-click'
|
||||
window.tracker?.trackEvent 'Inventory Play', category: 'Play Level', ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Inventory Play', category: 'Play Level'
|
||||
|
||||
updateConfig: (callback, skipSessionSave) ->
|
||||
sessionHeroConfig = @options.session.get('heroConfig') ? {}
|
||||
|
|
Loading…
Add table
Reference in a new issue