Skip to content

Commit

Permalink
添加一些事件上报
Browse files Browse the repository at this point in the history
  • Loading branch information
TooBug committed Nov 1, 2016
1 parent 6aeba8b commit c2ec51c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ other
src/public/node_modules
src/public/bundle.js.map
TooNote-darwin-x64
src/bundle.js
src/style/bundle.css
3 changes: 3 additions & 0 deletions src/component/editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default {
let ext = io.getExt(img.name);
let imagePath = io.saveImage(img.path, ext);
this.insertImg(imagePath);
window.ga('send', 'event', 'editor', 'insertImg', 'drag');
},
onPaste(e){
if(!e.clipboardData.items || !e.clipboardData.items.length) return;
Expand All @@ -63,6 +64,7 @@ export default {
let imagePath = io.saveImageFromClipboard();
this.insertImg(imagePath);
window.ga('send', 'event', 'editor', 'insertImg', 'paste');
},
insertImg(imagePath){
Expand Down Expand Up @@ -159,6 +161,7 @@ export default {
session.on('changeScrollTop', throttle((scroll) => {
let targetRow = aceEditor.getFirstVisibleRow();
this.$store.dispatch('syncScroll', targetRow);
window.ga('send', 'event', 'editor', 'scroll');
}, 500));
// if(timing && Date.now() - waitStart < 100) clearTimeout(timing);
// timing = setTimeout(function(){
Expand Down
5 changes: 5 additions & 0 deletions src/component/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ export default {
watch: {
keyword(){
if(this.keyword){
window.ga('send', 'event', 'note', 'searchStarted');
this.$store.dispatch('search', this.keyword);
}else{
window.ga('send', 'event', 'note', 'searchEnded');
this.$store.commit('switchSearching', false);
}
}
Expand All @@ -164,11 +166,13 @@ export default {
return ret;
},
switchCurrentNote(noteId){
window.ga('send', 'event', 'note', 'switchCurrentNote', 'click');
this.$store.dispatch('switchCurrentNoteById', noteId);
// eventHub.$emit('currentNoteChange', noteId);
},
showContextMenu(noteId){
// console.log('contextmenu');
window.ga('send', 'event', 'note', 'showContextMenu');
this.$store.commit('switchContextMenuNote', noteId);
// this.$nextTick(() => {
setTimeout(() => {
Expand Down Expand Up @@ -221,6 +225,7 @@ export default {
_doExchange();
},
drop(e){
window.ga('send', 'event', 'note', 'sort');
this.currentMovingNoteId = 0;
// console.log('drop', e);
}
Expand Down
2 changes: 2 additions & 0 deletions src/docs/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ TooNote是一款基于Markdown的笔记软件。
- [ ] 这是条未完成的todo
- [x] 已完成 (16-10-01 00:00)

`Command` + `I` 可快速切换todo模式,`Command` + `D` 可快速标记todo是否完成。

## 支持

任何意见建议欢迎通过[Github Issue](https://github.com/TooBug/TooNote/issues)提出。
10 changes: 7 additions & 3 deletions src/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
</div>
<versions></versions>
</div>
<script src="./bundle.js"></script>
<script>

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;

/*(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');*/

var uuid = require('uuid');

Expand All @@ -47,7 +48,10 @@
ga('set', 'checkProtocolTask', function(){}); // Disable file protocol checking.
ga('set', 'page', '/main.html');
ga('send', 'pageview');
ga('send', 'event', 'app', 'started');

</script>
<script src="./bundle.js"></script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
</body>
</html>
10 changes: 10 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,23 @@ let app = new Vue({
return content.split('\n',2)[0].replace(/^[# \xa0]*/g,'');
},
newNote(){
window.ga('send', 'event', 'note', 'new');
store.dispatch('newNote');
},
switchCurrentNote(note){
window.ga('send', 'event', 'note', 'switchCurrentNote', 'init');
store.commit('switchCurrentNote', note);
},
openContextMenuNote(){
window.ga('send', 'event', 'note', 'switchCurrentNote', 'contextMenu');
store.dispatch('openContextMenuNote');
},
deleteContextMenuNote(){
window.ga('send', 'event', 'note', 'delete', 'contextMenu');
store.dispatch('deleteContextMenuNote');
},
historyContextMenuNote(){
window.ga('send', 'event', 'history', 'enter', 'contextMenu');
store.dispatch('historyContextMenuNote');
},
switchCurrentNotebook(notebook){
Expand All @@ -56,18 +61,23 @@ let app = new Vue({
store.commit('updateNotebooks', metaData.notebook);
},
importBackup(){
window.ga('send', 'event', 'note', 'importBackup');
store.dispatch('importBackup');
},
export(format){
window.ga('send', 'event', 'note', 'export', format);
store.dispatch('export', format);
},
switchLayout(component){
window.ga('send', 'event', 'app', 'layout', component);
store.commit('switchLayout', component);
},
versionOpen(){
window.ga('send', 'event', 'history', 'switchActiveVersion');
store.dispatch('switchActiveVersion');
},
versionRestore(){
window.ga('send', 'event', 'history', 'restoreActiveVersion');
store.dispatch('restoreActiveVersion');
},
doEdit(action){
Expand Down

0 comments on commit c2ec51c

Please sign in to comment.