From f28a5cc49b807e6e4dc5c3d8c5cdb85e28a8200e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 22:29:07 +0200 Subject: [PATCH] Remove unused piwik-related code This code requires the variable `_paq` to be set somewhere, but we never set it. In the past Decide Madrid added some custom JavaScript using this code. However, in CONSUL we're using Ahoy to track events, and we don't have any documentation about adding custom JavaScript to use piwik nor we've got any other piwik integration. --- app/assets/javascripts/application.js | 2 -- app/assets/javascripts/tracks.js.coffee | 28 ------------------------- 2 files changed, 30 deletions(-) delete mode 100644 app/assets/javascripts/tracks.js.coffee diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index a7f7231b0..9174fd0ff 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -46,7 +46,6 @@ //= require registration_form //= require suggest //= require forms -//= require tracks //= require valuation_budget_investment_form //= require embed_video //= require fixed_bar @@ -105,7 +104,6 @@ var initialize_modules = function() { App.RegistrationForm.initialize(); App.Suggest.initialize(); App.Forms.initialize(); - App.Tracks.initialize(); App.ValuationBudgetInvestmentForm.initialize(); App.EmbedVideo.initialize(); App.FixedBar.initialize(); diff --git a/app/assets/javascripts/tracks.js.coffee b/app/assets/javascripts/tracks.js.coffee deleted file mode 100644 index e3f44e7f1..000000000 --- a/app/assets/javascripts/tracks.js.coffee +++ /dev/null @@ -1,28 +0,0 @@ -App.Tracks = - - tracking_enabled: -> - _paq? - - set_custom_var: (id, name, value, scope) -> - _paq.push(["setCustomVariable", id, name, value, scope]) - _paq.push(["trackPageView"]) - - track_event: ($this) -> - category = $this.data("track-event-category") - action = $this.data("track-event-action") - _paq.push(["trackEvent", category, action]) - - initialize: -> - if App.Tracks.tracking_enabled() - $("[data-track-usertype]").each -> - $this = $(this) - usertype = $this.data("track-usertype") - App.Tracks.set_custom_var(1, "usertype", usertype, "visit") - - $("[data-track-event-category]").each -> - $this = $(this) - App.Tracks.track_event($this) - - $("[data-track-click]").on "click", -> - $this = $(this) - App.Tracks.track_event($this)