Permalink
Browse files

Add support for www.gosquared.com (analytics)

  • Loading branch information...
1 parent c45fa28 commit 590bb2744db1549245317a49ecaa93bf84ad204e @hmans committed Oct 31, 2012
Showing with 22 additions and 0 deletions.
  1. +1 −0 lib/schnitzelpress/config.rb
  2. +3 −0 lib/views/admin/config.haml
  3. +2 −0 lib/views/layout.haml
  4. +16 −0 lib/views/partials/_gosquared.haml
@@ -15,6 +15,7 @@ class Config
field :disqus_id, :type => String
field :google_analytics_id, :type => String
field :gauges_id, :type => String
+ field :gosquared_id, :type => String
field :twitter_id, :type => String
field :cache_timestamp, :type => DateTime
@@ -22,6 +22,9 @@
= form_field config, :google_analytics_id, :label => "Google Analytics ID"
.six.columns
= form_field config, :gauges_id, :label => "Gauges ID"
+ .row
+ .six.columns
+ = form_field config, :gosquared_id, :label => "GoSquared ID"
.buttons
%input{:type => 'submit', :value => 'Update Configuration'}
@@ -28,5 +28,7 @@
= partial 'google_analytics'
- if production? && config.gauges_id.present?
= partial 'gauges'
+ - if production? && config.gosquared_id.present?
+ = partial 'gosquared'
%script{ :type => 'text/javascript', :src => "/assets/schnitzelpress.#{ASSET_TIMESTAMP}.js" }
@@ -0,0 +1,16 @@
+:javascript
+ var GoSquared = {};
+ GoSquared.acct = '#{config.gosquared_id}';
+ (function(w){
+ function gs(){
+ w._gstc_lt = +new Date;
+ var d = document, g = d.createElement("script");
+ g.type = "text/javascript";
+ g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
+ var s = d.getElementsByTagName("script")[0];
+ s.parentNode.insertBefore(g, s);
+ }
+ w.addEventListener ?
+ w.addEventListener("load", gs, false) :
+ w.attachEvent("onload", gs);
+ })(window);

0 comments on commit 590bb27

Please sign in to comment.