From b8cee4b22a4725981d744acc4226c991b5cc07ff Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Fri, 2 Dec 2016 10:33:11 +0530 Subject: [PATCH 1/6] tracking fixes. --- src/analytics.js | 2 +- src/script.js | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/analytics.js b/src/analytics.js index 12215b6..5bfefcd 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -4,7 +4,7 @@ window.trackEvent = function (category, action, label, value) { } } -// if online, load after 2 seconds +// if online, load after sometime if (navigator.onLine) { setTimeout(function() { (function(i,s,o,g,r,a,m){ diff --git a/src/script.js b/src/script.js index b6968b7..99b9e50 100644 --- a/src/script.js +++ b/src/script.js @@ -115,7 +115,6 @@ document.body.classList.add('layout-' + mode); resetSplitting(); - trackEvent('ui', 'toggleLayout', mode); } function saveSetting(setting, value) { @@ -250,6 +249,11 @@ function createPreviewFile(html, css, js) { var contents = '\n\n\n\n\n' + html + '\n\n'; + // Track if people are actually writing code. + if (!trackEvent.hasTrackedCode && (html || css || js)) { + trackEvent('fn', 'hasCode'); + trackEvent.hasTrackedCode = true; + } var fileWritten = false; var blob = new Blob([ contents ], { type: "text/plain;charset=UTF-8" }); @@ -354,9 +358,17 @@ CodeMirror.modeURL = "lib/codemirror/mode/%N/%N.js"; - layoutBtn1.addEventListener('click', function () { saveSetting('layoutMode', 1); toggleLayout(1); return false; }); - layoutBtn2.addEventListener('click', function () { saveSetting('layoutMode', 2); toggleLayout(2); return false; }); - layoutBtn3.addEventListener('click', function () { saveSetting('layoutMode', 3); toggleLayout(3); return false; }); + function getToggleLayoutButtonListener(mode) { + return function () { + saveSetting('layoutMode', mode); + trackEvent('ui', 'toggleLayoutClick', mode); + toggleLayout(mode); + return false; + }; + } + layoutBtn1.addEventListener('click', getToggleLayoutButtonListener(1)); + layoutBtn2.addEventListener('click', getToggleLayoutButtonListener(2)); + layoutBtn3.addEventListener('click', getToggleLayoutButtonListener(3)); helpBtn.addEventListener('click', function () { helpModal.classList.toggle('is-modal-visible'); From a7122306405ccd4d47c035afff45edd532dd70dd Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Fri, 2 Dec 2016 10:39:01 +0530 Subject: [PATCH 2/6] bump to 1.7.3 --- src/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manifest.json b/src/manifest.json index fc4ba6f..a76c018 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "name": "Web Maker", - "version": "1.7.2", + "version": "1.7.3", "manifest_version": 2, "description": "Convert new tabs into an offline playground for your web experiments", "homepage_url": "https://kushagragour.in/lab/web-maker", From 2b3d2a8e663a5393d644b773067bd5173fcd9de8 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Sun, 4 Dec 2016 13:48:14 +0530 Subject: [PATCH 3/6] eslint fixes. --- src/analytics.js | 7 +++++++ src/script.js | 1 + 2 files changed, 8 insertions(+) diff --git a/src/analytics.js b/src/analytics.js index 5bfefcd..3d7b029 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -1,3 +1,5 @@ +/* global ga */ +// eslint-disable-next-line max-params window.trackEvent = function (category, action, label, value) { if (window.ga) { ga('send', 'event', category, action, label, value); @@ -7,6 +9,8 @@ window.trackEvent = function (category, action, label, value) { // if online, load after sometime if (navigator.onLine) { setTimeout(function() { + + /* eslint-disable */ (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r; i[r]=i[r]||function(){ @@ -18,5 +22,8 @@ if (navigator.onLine) { // required for chrome extension protocol ga('set', 'checkProtocolTask', function(){ /* nothing */ }); ga('send', 'pageview'); + + /* eslint-enable */ + }, 0); } \ No newline at end of file diff --git a/src/script.js b/src/script.js index 99b9e50..eee4d6a 100644 --- a/src/script.js +++ b/src/script.js @@ -1,3 +1,4 @@ +/* global trackEvent */ /* eslint-disable no-extra-semi */ ;(function () { From fe7dfe990deaee1e38d1b1c8d6a2e837084164a6 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Sun, 4 Dec 2016 13:53:58 +0530 Subject: [PATCH 4/6] add travis build status --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a54eafb..3e2968b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Web-Maker +Web-Maker ![Build](https://travis-ci.org/chinchang/web-maker.svg?branch=master) ====== **Web-Maker** is a chrome extension that converts your Chrome tabs into an offline playground for your web experiments. Something like CodePen or JSFiddle, but much more faster and works offline being local on your system. From 620b8afda285aefc46594b3dfed2a48c3dab6468 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Sun, 11 Dec 2016 00:57:08 +0530 Subject: [PATCH 5/6] add usingpreview event. --- src/script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/script.js b/src/script.js index eee4d6a..3c617cc 100644 --- a/src/script.js +++ b/src/script.js @@ -255,6 +255,11 @@ trackEvent('fn', 'hasCode'); trackEvent.hasTrackedCode = true; } + // Track when people actually are working + trackEvent.previewCount = (trackEvent.previewCount || 0) + 1; + if (trackEvent.previewCount === 4) { + trackEvent('fn', 'usingPreview'); + } var fileWritten = false; var blob = new Blob([ contents ], { type: "text/plain;charset=UTF-8" }); From 6720a8a4e152ed5c20486f26859f87411172838e Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Sun, 11 Dec 2016 00:58:20 +0530 Subject: [PATCH 6/6] bump to 1.7.4 --- src/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manifest.json b/src/manifest.json index a76c018..2896457 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "name": "Web Maker", - "version": "1.7.3", + "version": "1.7.4", "manifest_version": 2, "description": "Convert new tabs into an offline playground for your web experiments", "homepage_url": "https://kushagragour.in/lab/web-maker",