Class: Ahoy::VisitProperties
- Inherits:
-
Object
- Object
- Ahoy::VisitProperties
- Defined in:
- lib/ahoy/visit_properties.rb
Instance Attribute Summary collapse
-
#landing_page ⇒ Object
readonly
Returns the value of attribute landing_page.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#referrer ⇒ Object
readonly
Returns the value of attribute referrer.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(request, api:) ⇒ VisitProperties
constructor
A new instance of VisitProperties.
Constructor Details
#initialize(request, api:) ⇒ VisitProperties
Returns a new instance of VisitProperties.
10 11 12 13 14 15 |
# File 'lib/ahoy/visit_properties.rb', line 10 def initialize(request, api:) @request = request @params = request.params @referrer = api ? params["referrer"] : request.referer @landing_page = api ? params["landing_page"] : request.original_url end |
Instance Attribute Details
#landing_page ⇒ Object (readonly)
Returns the value of attribute landing_page.
8 9 10 |
# File 'lib/ahoy/visit_properties.rb', line 8 def landing_page @landing_page end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/ahoy/visit_properties.rb', line 8 def params @params end |
#referrer ⇒ Object (readonly)
Returns the value of attribute referrer.
8 9 10 |
# File 'lib/ahoy/visit_properties.rb', line 8 def referrer @referrer end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
8 9 10 |
# File 'lib/ahoy/visit_properties.rb', line 8 def request @request end |
Instance Method Details
#generate ⇒ Object
17 18 19 |
# File 'lib/ahoy/visit_properties.rb', line 17 def generate @generate ||= request_properties.merge(tech_properties).merge(traffic_properties).merge(utm_properties) end |