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
Methods inherited from Data
Constructor Details
#initialize(url, title, referrers = nil) ⇒ PageView
Returns a new instance of PageView.
14 15 16 17 18 19 |
# File 'lib/kameleoon/data/page_view.rb', line 14 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.
9 10 11 |
# File 'lib/kameleoon/data/page_view.rb', line 9 def referrer @referrer end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/kameleoon/data/page_view.rb', line 9 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/kameleoon/data/page_view.rb', line 9 def url @url end |
Instance Method Details
#obtain_full_post_text_line ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/kameleoon/data/page_view.rb', line 21 def obtain_full_post_text_line nonce = Kameleoon::Utils.generate_random_string(NONCE_LENGTH) referrer_text = if !@referrers.nil? && !@referrers.empty? "&referrersIndices=%5B#{@referrers.each(&:to_s).join('%2C')}%5D" else '' end "eventType=page&href=#{self.class.encode(@url)}&title=#{self.class.encode(@title)}#{referrer_text}&nonce=#{nonce}" end |