Module: Vanity::Metric::GoogleAnalytics
- Defined in:
- lib/vanity/metric/google_analytics.rb
Overview
Calling google_analytics method on a metric extends it with these modules, redefining the values and hook methods.
Defined Under Namespace
Classes: Resource
Instance Method Summary (collapse)
-
- (Object) hook
Hooks not supported for GA metrics.
-
- (Object) last_update_at
Unkown (for now).
-
- (Object) report
Garb report.
- - (Object) track!(args = nil)
-
- (Object) values(from, to)
Returns values from GA using parameters specified by prior call to google_analytics.
Instance Method Details
- (Object) hook
Hooks not supported for GA metrics.
45 46 47 |
# File 'lib/vanity/metric/google_analytics.rb', line 45 def hook fail "Cannot use hooks with Google Analytics methods" end |
- (Object) last_update_at
Unkown (for now).
55 56 |
# File 'lib/vanity/metric/google_analytics.rb', line 55 def last_update_at end |
- (Object) report
Garb report.
50 51 52 |
# File 'lib/vanity/metric/google_analytics.rb', line 50 def report @ga_resource end |
- (Object) track!(args = nil)
58 59 |
# File 'lib/vanity/metric/google_analytics.rb', line 58 def track!(args = nil) end |
- (Object) values(from, to)
Returns values from GA using parameters specified by prior call to google_analytics.
37 38 39 40 41 42 |
# File 'lib/vanity/metric/google_analytics.rb', line 37 def values(from, to) data = @ga_resource.results(from, to).inject({}) do |hash,entry| hash.merge(entry.date=>@ga_mapper.call(entry)) end (from..to).map { |day| data[day.strftime('%Y%m%d')] || 0 } end |