<% if !@settings.google_id.blank? %>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(
    ['_setAccount', 'UA-38090057-1'],
    ['_setDomainName', 'crowdhoster.com'],
    ['_trackPageview'],
    ['b._setAccount', '<%= @site.google_id %>'],
    ['b._trackPageview']
  );

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
<% end %>

<script type="text/javascript">
  <% if Rails.env.development? %>
  window['ga-disable-UA-38090057-1'] = true;
  <% if !@settings.google_id.blank? %>
  window['ga-disable-<%= @settings.google_id %>'] = true;
  <% end %>
  <% end %>

  var _gaq = _gaq || [];
  _gaq.push(
    ['_setAccount', 'UA-38090057-1'],
    ['_setDomainName', 'crowdhoster.com'],
    ['_trackPageview']<% if !@settings.google_id.blank? %>,
    ['b._setAccount', '<%= @settings.google_id %>'],
    ['b._trackPageview']<% end %>
  );

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    <% if Rails.env.development? %>
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/u/ga_debug.js';
    <% else %>
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    <% end %>
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>

Enable tracking of sites even w/o custom GA ID, and configure dev settings
Enable tracking of sites even w/o custom GA ID, and configure dev settings
