Class: Nucleo::Models::FeedTypes::Analytics::Site::Pages

Inherits:
Base
  • Object
show all
Defined in:
lib/nucleo/models/feed_types/analytics/site/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)


44
45
46
# File 'lib/nucleo/models/feed_types/analytics/site/pages.rb', line 44

def any?
  self.current_period.rows?
end

#current_periodNucleo::Models::MetricPeriod

Delegates to the Metric Period



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

def current_period
  self.metric.metric_periods.current_period
end

#metricNucleo::Models::Metric

Returns the specific Metric for this page



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/nucleo/models/feed_types/analytics/site/pages.rb', line 17

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

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

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

Delegates to the Metric Period



51
52
53
# File 'lib/nucleo/models/feed_types/analytics/site/pages.rb', line 51

def prior_period
  self.metric.metric_periods.prior_period
end

#totalsNucleo::Models::MetricPeriodsTotals

Delegates to the Totals



33
34
35
# File 'lib/nucleo/models/feed_types/analytics/site/pages.rb', line 33

def totals
  self.metric.metric_periods.totals
end