<commit_before># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details

  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
end<commit_msg>Make the Rails example track every pageview with Keen<commit_after># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  before_filter :track_pageview


  # Runs before every request:
  def track_pageview

    # Get these from the keen.io website:
    project_id = "4f5775ad163d666a6100000e"
    auth_token = "<PASSWORD>"

    # First you must setup the client:
    keen = Keen::Client.new(project_id, auth_token)

    # Log the event with Keen:
    keen.add_event("pageviews", {
      :params   => params,
      :url      => request.url,
    })

  end

  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
end
{'fraction_non_alphanumeric': 0.05916305916305916, 'fraction_numerical': 0.012987012987012988, 'mean_word_length': 4.355212355212355, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1464408', 'n_tokens_mistral': 388, 'n_tokens_neox': 363, 'n_words': 143}