Skip to content

Commit 010913f

Browse files
Added Google Analytics for feedback tracking.
1 parent 9fe8ef4 commit 010913f

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

index.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,5 +2043,58 @@ <h1>Thank you!</h1>
20432043
$.deck('.slide');
20442044
});
20452045
</script>
2046+
2047+
<script type="text/javascript">
2048+
2049+
var _gaq = _gaq || [];
2050+
_gaq.push(['_setAccount', 'UA-246174-1']);
2051+
_gaq.push(['_trackPageview']);
2052+
2053+
(function() {
2054+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
2055+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
2056+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
2057+
})();
2058+
2059+
function trackQuality(feedback){
2060+
2061+
//the higher the value over time,
2062+
//the more the page should be tweaked since it's not understandable
2063+
var feedbackValue;
2064+
switch(feedback) {
2065+
case 'no':
2066+
feedbackValue = 2;
2067+
break;
2068+
case 'sortof':
2069+
feedbackValue = 1;
2070+
break;
2071+
default:
2072+
feedbackValue = 0;
2073+
}
2074+
2075+
if (_gaq) {
2076+
_gaq.push(['_trackEvent', "LLC HTML/CSS (Ottawa)", feedback, returnDocumentName(), feedbackValue, true]);
2077+
var feedbackDiv = document.getElementById('page_feedback');
2078+
feedbackDiv.innerHTML = "Thanks!";
2079+
}else{
2080+
console.log('_gaq is not defined');
2081+
}
2082+
}
2083+
2084+
function returnDocumentName() {
2085+
var fileName = document.location.href;
2086+
var end = (fileName.indexOf("?") == -1) ? fileName.length : fileName.indexOf("?");
2087+
return fileName.substring(fileName.lastIndexOf("/")+1, end);
2088+
}
2089+
2090+
</script>
2091+
2092+
<div id="page_feedback">
2093+
<strong>Help improve the quality of this workshop!</strong>
2094+
Did this page explain everything well?
2095+
<a href="#" onClick="trackQuality('yes');return false;" class="button">Yes</a>
2096+
<a href="#" onClick="trackQuality('sortof');return false;" class="button">Sort of</a>
2097+
<a href="#" onClick="trackQuality('no');return false;" class="button">No</a>
2098+
</div>
20462099
</body>
20472100
</html>

src/css/coderdeck.css

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,33 @@ pre.prettyprint {
389389
color: #888;
390390
font-size: 16px !important;
391391
font-style: italic !important;
392-
}
392+
}
393+
394+
/* **** */
395+
396+
#page_feedback {
397+
border-top: 1px dashed rgb(223, 223, 223);
398+
padding: 10px 0;
399+
text-align: center;
400+
font-size: 0.9em;
401+
color: #666;
402+
margin-top: 60px;
403+
}
404+
405+
#page_feedback div {
406+
position: relative;
407+
padding: 3px 10px 3px 0px;
408+
}
409+
410+
#page_feedback a {
411+
margin-left: 5px;
412+
border: 1px solid #ccc;
413+
color: #666;
414+
padding: 0 10px;
415+
text-decoration: none;
416+
}
417+
#page_feedback a:hover {
418+
color: #B1009A;
419+
}
420+
421+
/* **** */

0 commit comments

Comments
 (0)