<commit_before>module AnalyticoController
  
  private
  
    def analytico_impression
      Analytico::Client.add_impression(:fqdn => request.host, :ip => request.ip, :user_agent => request.user_agent, :referrer => request.referrer, :url => request.path)
		end
  
end

if defined? ActionController
  ActionController::Base.send :include, AnalyticoController
end<commit_msg>Added unique visitor support through cookies<commit_after>module AnalyticoController
  
  private
  
    def analytico_impression
      if cookies
        if cookies[:analytico]
          analytico_cookie = cookies[:analytico]
        else
          analytico_cookie = generate_cookie
          cookies[:analytico] = {
            :value => analytico_cookie,
            :expires => 2.years.from_now,
            :domain => request.host
          }
        end
      
        Analytico::Client.add_impression(:fqdn => request.host, 
                                         :ip => request.ip, 
                                         :user_agent => request.user_agent, 
                                         :referrer => request.referrer, 
                                         :url => request.path,
                                         :cookie => analytico_cookie)
      else
        Analytico::Client.add_impression(:fqdn => request.host, 
                                         :ip => request.ip, 
                                         :user_agent => request.user_agent, 
                                         :referrer => request.referrer, 
                                         :url => request.path)
      end
		end
		
		def generate_cookie
		  digest = Digest::MD5.new
		  digest << "#{Time.now}-#{rand(999999)}"
		  digest.to_s
		end
  
end

if defined? ActionController
  ActionController::Base.send :include, AnalyticoController
end
{'fraction_non_alphanumeric': 0.0849210669569951, 'fraction_numerical': 0.004354926510615134, 'mean_word_length': 1.5281980742778543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7473897', 'n_tokens_mistral': 472, 'n_tokens_neox': 454, 'n_words': 91}