Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add Gauges tracking code

  • Loading branch information...
commit c1918147cab43889f51fbcef3f179603c8d2d7ee 1 parent aa3633d
@mislav authored
View
20 app.rb
@@ -8,6 +8,26 @@
require 'mustache/sinatra'
set :mustache, { :templates => './templates', :views => './views' }
+module TrackingCode
+ def tracking_code
+ <<-HTML
+ <script type="text/javascript">
+ var _gauges = _gauges || [];
+ (function() {
+ var t = document.createElement('script');
+ t.type = 'text/javascript';
+ t.async = true;
+ t.id = 'gauges-tracker';
+ t.setAttribute('data-site-id', '511993a0f5a1f5137f00004f');
+ t.src = '//secure.gaug.es/track.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(t, s);
+ })();
+ </script>
+ HTML
+ end
+end
+
require 'rocco_ext'
configure :development do
View
2  rocco_ext.rb
@@ -18,6 +18,8 @@
Rocco::Layout.template_name = 'rocco'
Rocco::Layout.class_eval do
+ include TrackingCode
+
def highlight_style
@doc.options[:uv_style]
end
View
1  templates/layout.mustache
@@ -10,4 +10,5 @@
<div id="background"></div>
{{{ yield }}}
</div>
+ {{{ tracking_code }}}
</body>
View
2  templates/rocco.mustache
@@ -48,4 +48,6 @@
{{/sections}}
</table>
</div>
+
+{{{ tracking_code }}}
</body>
View
1  views/layout.rb
@@ -1,5 +1,6 @@
module Sinatra::Application::Views
class Layout < Mustache
+ include TrackingCode
def highlight_style
::Sinatra::Application.rocco[:uv_style]

0 comments on commit c191814

Please sign in to comment.
Something went wrong with that request. Please try again.