From f77d4c618e331a2874ef483b8bae055cc6937817 Mon Sep 17 00:00:00 2001 From: "Eduardo R. D'Avila" Date: Thu, 15 Dec 2011 23:39:06 -0200 Subject: [PATCH] =?UTF-8?q?Revis=C3=A3o=20de=20eventos=20de=20Analytics=20?= =?UTF-8?q?nas=20p=C3=A1ginas=20de=20background.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.txt | 8 ++++++-- src/background/main.html | 3 +-- src/background/options.html | 3 +++ src/background/stats_begin.js | 24 ++++++++++++++++++++---- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/TODO.txt b/TODO.txt index ca6d5a8..882af8a 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,5 @@ Opções ------ - Instruções devem ser mostradas na primeira instalação. TopicListPage @@ -10,12 +9,17 @@ TopicListPage TopicMessagesPage ----------------- Bug when opening a topic with zero messages. + FIXED? - Posicionar a página na primeira mensagem não-lida (opção). + Posicionar a página na primeira mensagem não-lida (opção?). Geral ----- + Analytics + Registrar evento de importação de dados. + Transformar pageview de main.html em evento (?). + Refatorar todo o código! Hierarquia de classes. Reaproveitamento de código. diff --git a/src/background/main.html b/src/background/main.html index b7d18c3..f4f339a 100644 --- a/src/background/main.html +++ b/src/background/main.html @@ -38,6 +38,7 @@ Options.get(function(options) { getManifest(function(manifest) { stats.setVersion(manifest.version); + stats.loaded(); var lastUsedVersion = options.lastUsedVersion; if(lastUsedVersion != manifest.version) { @@ -51,8 +52,6 @@ stats.install(manifest.version, lastUsedVersion); } - - stats.pageview(); }); }); diff --git a/src/background/options.html b/src/background/options.html index 4c3d1dc..7761b74 100644 --- a/src/background/options.html +++ b/src/background/options.html @@ -96,6 +96,7 @@ Options.get(function(options) { options[option] = checkbox.checked; Options.set(options); + stats.optionsSaved(); }); } @@ -148,6 +149,7 @@ activeContentPanel.style.display = "block"; contentTitle.textContent = activeNavBarItem.textContent; + document.title = "Marcador de Tópicos para o Orkut™ - " + activeNavBarItem.textContent; stats.pageview(document.location.pathname + hash); } @@ -192,6 +194,7 @@ } alert("Os dados foram importados corretamente."); + stats.dataImported(); } diff --git a/src/background/stats_begin.js b/src/background/stats_begin.js index 38688f8..7c00474 100644 --- a/src/background/stats_begin.js +++ b/src/background/stats_begin.js @@ -5,7 +5,7 @@ _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); var stats = (function() { return { setVersion: function(version) { - _gaq.push(['_setCustomVar', 1/*slot*/, 'v', version, 2/*scope:session*/]); + _gaq.push(['_setCustomVar', 1/*slot*/, 'ver', version, 2/*scope:session*/]); }, pageview: function(url) { @@ -16,16 +16,32 @@ var stats = (function() { } }, + loaded: function() { + this._event('main page', 'loaded'); + }, + install: function(newVersion, oldVersion) { if(oldVersion) { - _gaq.push(['_trackEvent', 'install', 'update', newVersion + '<-' + oldVersion]); + this._event('install', 'update', newVersion + '<-' + oldVersion); } else { - _gaq.push(['_trackEvent', 'install', 'new', newVersion]); + this._event('install', 'new', newVersion); } }, instructionsOpened: function() { - _gaq.push(['_trackEvent', 'Instructions Page', 'on install']); + this._event('instructions page', 'on install'); + }, + + optionsSaved: function() { + this._event('options page', 'options saved'); + }, + + dataImported: function() { + this._event('options page', 'data imported'); + }, + + _event: function(category, action, value) { + _gaq.push(['_trackEvent', category, action, value]); }, }; })();