Class: Kameleoon::PageView
Overview
Represents page view data for tracking calls
Instance Attribute Summary collapse
-
#referrer ⇒ Object
readonly
Returns the value of attribute referrer.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from Data
Instance Method Summary collapse
-
#initialize(url, title, referrers = nil) ⇒ PageView
constructor
A new instance of PageView.
- #obtain_full_post_text_line ⇒ Object
Constructor Details
#initialize(url, title, referrers = nil) ⇒ PageView
Returns a new instance of PageView.
15 16 17 18 19 20 |
# File 'lib/kameleoon/data/page_view.rb', line 15 def initialize(url, title, referrers = nil) super(DataType::PAGE_VIEW) @url = url || '' @title = title || '' @referrers = referrers.instance_of?(Integer) ? [referrers] : referrers end |
Instance Attribute Details
#referrer ⇒ Object (readonly)
Returns the value of attribute referrer.
10 11 12 |
# File 'lib/kameleoon/data/page_view.rb', line 10 def referrer @referrer end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/kameleoon/data/page_view.rb', line 10 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/kameleoon/data/page_view.rb', line 10 def url @url end |
Instance Method Details
#obtain_full_post_text_line ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kameleoon/data/page_view.rb', line 22 def obtain_full_post_text_line params = { eventType: 'page', href: @url, title: @title, nonce: nonce } params[:referrersIndices] = "[#{@referrers.each(&:to_s).join(',')}]" if !@referrers.nil? && !@referrers.empty? Kameleoon::Network::UriHelper.encode_query(params) end |