Sha256: cd010f94d1ee06cab9f57a0547d0a8d1be0798f3d18c515d0f1aa075e266a632

Contents?: true

Size: 542 Bytes

Versions: 5

Compression:

Stored size: 542 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

5 entries across 5 versions & 1 rubygems

Version Path
ahoy_matey-1.1.1 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.1.0 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.0.2 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.0.1 lib/ahoy/deckhands/utm_parameter_deckhand.rb
ahoy_matey-1.0.0 lib/ahoy/deckhands/utm_parameter_deckhand.rb