Sha256: b9e7b3032578b65558e2f69f6e6af99ed9c2458b56cadc48580f303f79cc370d

Contents?: true

Size: 1.27 KB

Versions: 37

Compression:

Stored size: 1.27 KB

Contents

//= require jquery
//= require jquery_ujs
//= require jquery.cookie
//= require lodash
//= require is
//= require bootstrap
//= require rails.validations
//= require rails.validations.simple_form
//
//= require_tree ./init
//
//= require_self

var is = require('is')
var _  = require('lodash')

track = function(event, attributes, fn){
  console.log("Track: " + event + " " + JSON.stringify(attributes))

  if (is.fn(attributes)) fn = attributes, attributes = null;
  if (is.undefined(attributes)) { attributes = {} }
  if ($.cookie('invisible') == "true") {
    if (!is.undefined(fn)) { fn() }
    return
  }

  if (typeof(analytics) == 'undefined') {
    return
  }

  attrs = _.extend({
    iteration: '<%= MVP::Iteration.version %>'
  }, attributes)

  analytics.track(event, attrs, fn)
}

setupAutomaticTracing = function(){
  _.each(arguments, function(e){
    switch (e.toLowerCase()) {
      case 'buttons':
        $('.btn').on('click', function(){
          window.track("Button Clicked", { name: $(this).text() || $(this).attr('value') })
        })
        break;
      case 'links':
        $('a:not(.btn)').on('click', function(){
          window.track("Link Clicked", { name: ($(this).text() || $(this).attr('value')) })
        })
        break;
    }
  })
}

window.track = track;

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
minimum_viable_product-0.2.7 app/assets/javascripts/mvp/application.js.erb
minimum_viable_product-0.2.6 app/assets/javascripts/mvp/application.js.erb
minimum_viable_product-0.2.5 app/assets/javascripts/mvp/application.js.erb
minimum_viable_product-0.2.4 app/assets/javascripts/mvp/application.js.erb
minimum_viable_product-0.2.3 app/assets/javascripts/mvp/application.js.erb
minimum_viable_product-0.2.2 app/assets/javascripts/mvp/application.js.erb
minimum_viable_product-0.2.1 app/assets/javascripts/mvp/application.js.erb
minimum_viable_product-0.1.2 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.1.1 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.1.0 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.42 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.41 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.40 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.39 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.38 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.37 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.36 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.35 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.34 app/assets/javascripts/minimum_viable_product/application.js.erb
minimum_viable_product-0.0.33 app/assets/javascripts/minimum_viable_product/application.js.erb