Class: Kameleoon::PageView
- Inherits:
-
DuplicationSafeData
- Object
- Data
- DuplicationSafeData
- Kameleoon::PageView
- Defined in:
- lib/kameleoon/data/page_view.rb
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 = nil, referrers = nil) ⇒ PageView
constructor
A new instance of PageView.
- #obtain_full_post_text_line ⇒ Object
- #to_s ⇒ Object
Methods inherited from Data
#mark_as_sent, #mark_as_transmitting, #mark_as_unsent, #sent, #transmitting, #unsent
Constructor Details
#initialize(url, title = nil, referrers = nil) ⇒ PageView
Returns a new instance of PageView.
20 21 22 23 24 25 26 |
# File 'lib/kameleoon/data/page_view.rb', line 20 def initialize(url, title = nil, referrers = nil) super(DataType::PAGE_VIEW) @url = url || '' Logging::KameleoonLogger.error('Url for PageView is required parameter, the data will be ignored.') if @url == '' @title = title || '' @referrers = referrers.instance_of?(Integer) ? [referrers] : referrers end |
Instance Attribute Details
#referrer ⇒ Object (readonly)
Returns the value of attribute referrer.
11 12 13 |
# File 'lib/kameleoon/data/page_view.rb', line 11 def referrer @referrer end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
11 12 13 |
# File 'lib/kameleoon/data/page_view.rb', line 11 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/kameleoon/data/page_view.rb', line 11 def url @url end |
Instance Method Details
#obtain_full_post_text_line ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kameleoon/data/page_view.rb', line 28 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 |
#to_s ⇒ Object
13 14 15 |
# File 'lib/kameleoon/data/page_view.rb', line 13 def to_s "PageView{url:'#{@url}',title:'#{@title}',referrers:#{@referrers}}" end |