<commit_before>module Analytical
  module Modules
    class CommissionJunction
      include Analytical::Modules::Base

      def initialize(options={})
        super
        @tracking_command_location = :body_append
      end

      def init_javascript(location)
        init_location(location) do
          js = <<-HTML
          HTML

          cj_commands = []

          @command_store.commands.each do |c|
            if c[0] == :pixel_track
              cj_commands << pixel_track(*c[1..-1])
            end
          end

          js += "\n" + cj_commands.join("\n")
          @command_store.commands = @command_store.commands.delete_if {|c| c[0] == :pixel_track }

          js
        end
      end

      def pixel_track(user_id, domain_size = 0)
        lead_size = 1
        if(!domain_size == 0)
          case domain_size
            when 0..9 then lead_size = 1
            when 10..99 then lead_size = 2
            else lead_size = 3
          end
        end
<commit_msg>Code cleanup.<commit_after>module Analytical
  module Modules
    class CommissionJunction
      include Analytical::Modules::Base

      def initialize(options={})
        super
        @tracking_command_location = :body_append
      end

      def init_javascript(location)
        init_location(location) do
          js = <<-HTML
          HTML

          cj_commands = []

          @command_store.commands.each do |c|
            if c[0] == :pixel_track
              cj_commands << pixel_track(*c[1..-1])
            end
          end

          js += "\n" + cj_commands.join("\n")
          @command_store.commands = @command_store.commands.delete_if {|c| c[0] == :pixel_track }

          js
        end
      end

      def pixel_track(user_id, domain_size = 0)
        lead_size = 1
        unless domain_size == 0
          case domain_size
            when 0..9 then lead_size = 1
            when 10..99 then lead_size = 2
            else lead_size = 3
          end
        end

{'fraction_non_alphanumeric': 0.08962739174219536, 'fraction_numerical': 0.016112789526686808, 'mean_word_length': 1.600785340314136, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '361354', 'n_tokens_mistral': 604, 'n_tokens_neox': 561, 'n_words': 138}