Changeset 1338

Show
Ignore:
Timestamp:
08/09/08 11:21:38 (5 months ago)
Author:
alban
Message:

Define a Google Analytics account in the request when a tracker_id is defined in the Host. Fixes #18

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/public_controller.rb

    r1334 r1338  
    66  append_view_path "#{RAILS_ROOT}/templates" 
    77 
    8   before_filter :assigns_show 
     8  before_filter :assigns_show, :create_user_google_analytics_account 
    99 
    1010  def welcome 
     
    9393  end 
    9494 
     95  def create_user_google_analytics_account 
     96    user_tracker_id = (@show.host and @show.host.google_analytics_tracker_id) 
     97 
     98    unless user_tracker_id.blank? 
     99      request.google_analytics_account = Rubaidh::GoogleAnalytics.new(user_tracker_id) 
     100    end 
     101  end 
     102 
    95103  def find_show(slug = nil) 
    96104    @show ||= Show.find_by_slug(slug)