<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/migrate/20091024220937_add_google_analytics_code_to_site.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -28,8 +28,10 @@ class SitesController &lt; ApplicationController
   def update
     @site = Site.find(params[:id])
     if @site.update_attributes(params[:site])
-      @site.update_attribute(:hashed_password, Site.encrypted_password(params[:site][:password]))
-      session[:password] = @site.hashed_password
+      if !params[:site][:password].blank?
+        @site.update_attribute(:hashed_password, Site.encrypted_password(params[:site][:password]))
+        session[:password] = @site.hashed_password
+      end
       flash[:notice] = &quot;Site updated!&quot;
       redirect_to root_path
     else</diff>
      <filename>app/controllers/sites_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -94,4 +94,12 @@
             %li.twitter= link_to website.twitter_username, &quot;http://twitter.com/#{website.twitter_username}&quot; if website.twitter_username
         .clear
         #copyright= &quot;#{website.name} &amp;copy; #{Time.now.year} #{website.owner_name}&quot;
-        #powered-by= &quot;&lt;em&gt;#{t(:powered_by)}&lt;/em&gt; #{link_to 'rehash', 'http://github.com/webandy/rehash'}&quot;
\ No newline at end of file
+        #powered-by= &quot;&lt;em&gt;#{t(:powered_by)}&lt;/em&gt; #{link_to 'rehash', 'http://github.com/webandy/rehash'}&quot;
+- if !website.google_analytics_code.blank?
+  :javascript
+    var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);
+    document.write(unescape(&quot;%3Cscript src='&quot; + gaJsHost + &quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E&quot;));
+    try {
+    var pageTracker = _gat._getTracker(&quot;#{website.google_analytics_code}&quot;);
+    pageTracker._trackPageview();
+    } catch(err) {}
\ No newline at end of file</diff>
      <filename>app/views/layouts/application.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -54,6 +54,11 @@
         %span= &quot;Optional&quot;
         %br
         = f.text_field :twitter_username
+      %p
+        = f.label :google_analytics_code, 'Google Analytics'
+        %span= &quot;e.g. UA-14747133-1&quot;
+        %br
+        = f.text_field :google_analytics_code
     #password
       %p
         = f.label :password</diff>
      <filename>app/views/sites/_form.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version =&gt; 20091024063459) do
+ActiveRecord::Schema.define(:version =&gt; 20091024220937) do
 
   create_table &quot;articles&quot;, :force =&gt; true do |t|
     t.string   &quot;title&quot;
@@ -60,6 +60,7 @@ ActiveRecord::Schema.define(:version =&gt; 20091024063459) do
     t.string   &quot;theme&quot;
     t.string   &quot;flickr_username&quot;
     t.string   &quot;twitter_username&quot;
+    t.string   &quot;google_analytics_code&quot;
   end
 
   create_table &quot;slugs&quot;, :force =&gt; true do |t|</diff>
      <filename>db/schema.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cad9a47c7915295fe9b3cf4e24190030e82bb01a</id>
    </parent>
  </parents>
  <author>
    <name>Andy Atkinson</name>
    <email>andy@webandy.com</email>
  </author>
  <url>http://github.com/webandy/rehash/commit/e21b04ebcf41495ab4bcf1031d9377b203b87602</url>
  <id>e21b04ebcf41495ab4bcf1031d9377b203b87602</id>
  <committed-date>2009-10-24T15:17:29-07:00</committed-date>
  <authored-date>2009-10-24T15:17:29-07:00</authored-date>
  <message>adding ga code for stat tracking</message>
  <tree>6d7dec397098f8f42466e334fa48cc3540d6f281</tree>
  <committer>
    <name>Andy Atkinson</name>
    <email>andy@webandy.com</email>
  </committer>
</commit>
