Class: GaTrackable::VideoPlaysFetcher
- Inherits:
-
BaseFetcher
- Object
- BaseFetcher
- GaTrackable::VideoPlaysFetcher
- Defined in:
- lib/ga_trackable/video_plays_fetcher.rb
Constant Summary collapse
- GA_FILTER =
'Video Plays'
Constants inherited from BaseFetcher
Instance Attribute Summary
Attributes inherited from BaseFetcher
#end_date, #sometime_processed_counters, #start_date
Instance Method Summary collapse
- #counter_class ⇒ Object
-
#get_details_for(start_date: 1.year.ago, path:) ⇒ Object
Поулчить данные по просмотрам для конкретного пути.
Methods inherited from BaseFetcher
#fetch_for_current_day!, #initialize
Constructor Details
This class inherits a constructor from GaTrackable::BaseFetcher
Instance Method Details
#counter_class ⇒ Object
6 7 8 |
# File 'lib/ga_trackable/video_plays_fetcher.rb', line 6 def counter_class GaTrackable::VideoPlaysCounter end |
#get_details_for(start_date: 1.year.ago, path:) ⇒ Object
Поулчить данные по просмотрам для конкретного пути. Используется в rake-таске.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ga_trackable/video_plays_fetcher.rb', line 11 def get_details_for(start_date: 1.year.ago, path:) ga_start_date = start_date.in_time_zone.strftime(GA_DATE_FORMAT) ga_end_date = DateTime.current.strftime(GA_DATE_FORMAT) data = @client.execute(api_method: @analytics.data.ga.get, parameters: { 'ids' => "ga:#{@config.view_id}", 'start-date' => ga_start_date, 'end-date' => ga_end_date, 'dimensions' => 'ga:eventCategory,ga:eventAction', 'metrics' => 'ga:uniqueEvents,ga:totalEvents', 'sort' => 'ga:eventCategory,ga:eventAction', 'filters' => "ga:eventCategory==#{GA_FILTER};ga:eventAction=@#{path}" }).data end |