Class: Nucleo::Models::FeedTypes::Analytics::Page::Pages

Inherits:
Base
  • Object
show all
Defined in:
lib/nucleo/models/feed_types/analytics/page/pages.rb

Constant Summary collapse

DIMENSION_NAME =
'ga:pageviews'.freeze
METRIC_NAME =
'ga:pageviews'.freeze

Instance Method Summary collapse

Methods inherited from Base

#<=>, #analytics_category?, #category, #children, #children?, #context, #executed_at, #id, #initialize, #page, #page?, #page_context?, #page_recommendation_id, #record_id, #seo_category?, #site_analytic_id, #site_context?, #site_id, #status, #type

Constructor Details

This class inherits a constructor from Nucleo::Models::FeedTypes::Base

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/nucleo/models/feed_types/analytics/page/pages.rb', line 41

def any?
  self.current_period.rows?
end

#current_periodNucleo::Models::MetricPeriod

Delegates to the Metric Period



37
38
39
# File 'lib/nucleo/models/feed_types/analytics/page/pages.rb', line 37

def current_period
  self.metric.metric_periods.current_period
end

#metricNucleo::Models::Metric

Returns the specific Metric for this page



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/nucleo/models/feed_types/analytics/page/pages.rb', line 14

def metric
  params = {
    'metric'         => METRIC_NAME,
    'dimension'      => DIMENSION_NAME,
    'classification' => @attributes['classification'],
    'totals'         => data['totals'],
    'current_period' => data['current_period'],
    'prior_period'   => data['prior_period']
  }

  Nucleo::Models::Metric.new(params)
end

#prior_periodNucleo::Models::MetricPeriod Also known as: previous_period

Delegates to the Metric Period



48
49
50
# File 'lib/nucleo/models/feed_types/analytics/page/pages.rb', line 48

def prior_period
  self.metric.metric_periods.prior_period
end

#totalsNucleo::Models::MetricPeriodsTotals

Delegates to the Totals



30
31
32
# File 'lib/nucleo/models/feed_types/analytics/page/pages.rb', line 30

def totals
  self.metric.metric_periods.totals
end