Sha256: 1c087173a65be0c59e78c745388f36d868b278a1572f4e1b9175cf8d3f65b25c

Contents?: true

Size: 540 Bytes

Versions: 11

Compression:

Stored size: 540 Bytes

Contents

module Ahoy
  module Deckhands
    class UtmParameterDeckhand
      def initialize(landing_page)
        @landing_page = landing_page
      end

      def landing_params
        @landing_params ||= begin
          landing_uri = Addressable::URI.parse(@landing_page) rescue nil
          (landing_uri && landing_uri.query_values) || {}
        end
      end

      %w(utm_source utm_medium utm_term utm_content utm_campaign).each do |name|
        define_method name do
          landing_params[name]
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ahoy_matey-1.5.2 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.5.1 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.5.0 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.4.2 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.4.1 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.4.0 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.3.1 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.3.0 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.2.2 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.2.1 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.2.0 lib/ahoy/deckhands/utm_parameter_deckhand.rb