Class: SnowplowTracker::Page
- Inherits:
-
Object
- Object
- SnowplowTracker::Page
- Defined in:
- lib/snowplow-tracker/page.rb
Overview
For Tracker#track_page_view, properties set in the Page object will override those properties given as arguments.
If the Ruby tracker is incorporated into a website server, the events tracked will describe user activity on specific webpages. Knowing on which page an event occurred can be very valuable.
Add page URL, page title and referrer URL to any event by adding a Page
object to any Tracker #track_x_event
method call.
Page parameters are saved into the tracked event as part of the 'atomic'
event properties, which have their own column in the eventual events table.
For example, a Page's page_url
parameter will be sent as url
in the
raw event payload, ending up in the page_url
column.
Instance Attribute Summary collapse
-
#details ⇒ Hash
readonly
The stored page properties.
Instance Method Summary collapse
-
#initialize(page_url: nil, page_title: nil, referrer: nil) ⇒ Page
constructor
Create a Page object for attaching page properties to events.
Constructor Details
#initialize(page_url: nil, page_title: nil, referrer: nil) ⇒ Page
Create a Page object for attaching page properties to events.
Page properties will directly populate the event's page_url
, page_title
and referrer
parameters.
49 50 51 52 53 |
# File 'lib/snowplow-tracker/page.rb', line 49 def initialize(page_url: nil, page_title: nil, referrer: nil) @details = { 'url' => page_url, 'page' => page_title, 'refr' => referrer } end |
Instance Attribute Details
#details ⇒ Hash (readonly)
Returns the stored page properties.
35 36 37 |
# File 'lib/snowplow-tracker/page.rb', line 35 def details @details end |