exclude snippets

How to exclude your own traffic from Google Analytics reports and other JavaScript based analytics software

Tagged google, analytics, tracking, exclude, traffic  Languages ruby

Option 1: Changing your browser's user agent

Open the about:config page in Firefox by typing about:config in the address bar and pressing enter. Now change the general.useragent.extra.firefox setting to an easily identifiable string, for example the following:

Firefox/3.0 disable-tracking

Then in your code check that the user-agent string doesn't contain disable-tracking

<% if !request.user_agent.include?('disable-tracking') %>
TRACKING CODE GOES HERE
<% end %>

Option 2:

Use one of Google Analytics native ways of excluding traffic from certain domains, IPs, user-agents or users having a specific browser cookie.

Ignoring columns with acts_as_versioned

Tagged version, exclude, acts_as_versioned  Languages ruby
def Model

  @@versioned_columns = [:title, :body, :rendered_body, :user_id]  
  acts_as_versioned :if_changed => @@versioned_columns

  def self.non_versioned_columns
      self.class.columns.collect(&:name) - @@versioned_columns
  end
end