Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Commit

Permalink
Add support for www.gosquared.com (analytics)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmans committed Oct 31, 2012
1 parent c45fa28 commit 590bb27
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/schnitzelpress/config.rb
Expand Up @@ -15,6 +15,7 @@ class Config
field :disqus_id, :type => String field :disqus_id, :type => String
field :google_analytics_id, :type => String field :google_analytics_id, :type => String
field :gauges_id, :type => String field :gauges_id, :type => String
field :gosquared_id, :type => String
field :twitter_id, :type => String field :twitter_id, :type => String


field :cache_timestamp, :type => DateTime field :cache_timestamp, :type => DateTime
Expand Down
3 changes: 3 additions & 0 deletions lib/views/admin/config.haml
Expand Up @@ -22,6 +22,9 @@
= form_field config, :google_analytics_id, :label => "Google Analytics ID" = form_field config, :google_analytics_id, :label => "Google Analytics ID"
.six.columns .six.columns
= form_field config, :gauges_id, :label => "Gauges ID" = form_field config, :gauges_id, :label => "Gauges ID"
.row
.six.columns
= form_field config, :gosquared_id, :label => "GoSquared ID"


.buttons .buttons
%input{:type => 'submit', :value => 'Update Configuration'} %input{:type => 'submit', :value => 'Update Configuration'}
2 changes: 2 additions & 0 deletions lib/views/layout.haml
Expand Up @@ -28,5 +28,7 @@
= partial 'google_analytics' = partial 'google_analytics'
- if production? && config.gauges_id.present? - if production? && config.gauges_id.present?
= partial 'gauges' = partial 'gauges'
- if production? && config.gosquared_id.present?
= partial 'gosquared'


%script{ :type => 'text/javascript', :src => "/assets/schnitzelpress.#{ASSET_TIMESTAMP}.js" } %script{ :type => 'text/javascript', :src => "/assets/schnitzelpress.#{ASSET_TIMESTAMP}.js" }
16 changes: 16 additions & 0 deletions lib/views/partials/_gosquared.haml
@@ -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.