Skip to content

Instantly share code, notes, and snippets.

@kosmikko
Created June 30, 2012 14:03
Show Gist options
  • Select an option

  • Save kosmikko/3023870 to your computer and use it in GitHub Desktop.

Select an option

Save kosmikko/3023870 to your computer and use it in GitHub Desktop.
Provides common extensions to Chaplin views to be used as a mixin
define [
'chaplin'
'Handlebars'
], (Chaplin, Handlebars) ->
'use strict'
BaseExtensions =
trackAction: (category, action, label, value) ->
# track user action with Google Analytics
# label and value are optional
if _gaq?
arr = ['_trackEvent', category, action]
if label and value
arr.push label + ':' + value
_gaq.push(arr)
###
More functions & properties...
###
BaseExtensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment