Skip to content

Instantly share code, notes, and snippets.

@carlosramireziii
Created January 3, 2012 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosramireziii/1556909 to your computer and use it in GitHub Desktop.
Save carlosramireziii/1556909 to your computer and use it in GitHub Desktop.
Adding a cookie for Google Analytics to filter internal traffic in a Rails application
doctype 5
html
head
title Internal Traffic Cookie
= csrf_meta_tags
meta[name='robots' content='noindex']
body onLoad="javascript:_gaq.push(['_setVar', 'do_not_track_internal_traffic']);"
= yield
class Admin::AnalyticsCookiesController < ApplicationController
http_basic_authenticate_with :name => "admin", :password => "secret"
end
h1 Cookie was added!
# Add to routes.rb
namespace :admin do
resource :analytics_cookies, :only => :new
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment