Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Commit

Permalink
Revisão de eventos de Analytics nas páginas de background.
Browse files Browse the repository at this point in the history
  • Loading branch information
erdavila committed Dec 16, 2011
1 parent d1f585c commit f77d4c6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
8 changes: 6 additions & 2 deletions TODO.txt
@@ -1,6 +1,5 @@
Opções
------
Instruções devem ser mostradas na primeira instalação.


TopicListPage
Expand All @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions src/background/main.html
Expand Up @@ -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) {
Expand All @@ -51,8 +52,6 @@

stats.install(manifest.version, lastUsedVersion);
}

stats.pageview();
});
});

Expand Down
3 changes: 3 additions & 0 deletions src/background/options.html
Expand Up @@ -96,6 +96,7 @@
Options.get(function(options) {
options[option] = checkbox.checked;
Options.set(options);
stats.optionsSaved();
});
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -192,6 +194,7 @@
}

alert("Os dados foram importados corretamente.");
stats.dataImported();
}
</script>
</head>
Expand Down
24 changes: 20 additions & 4 deletions src/background/stats_begin.js
Expand Up @@ -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) {
Expand All @@ -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]);
},
};
})();

0 comments on commit f77d4c6

Please sign in to comment.