Module: Ga4Rails::Model::ClassMethods
- Defined in:
- lib/ga4-rails/model.rb
Constant Summary collapse
- DATE_FORMAT =
'%Y-%m-%d'.freeze
Instance Method Summary collapse
- #dimensions(*dimensions) ⇒ Object
- #metrics(*metrics) ⇒ Object
- #results(access_token:, property_id:, start_date:, end_date:, limit: 1000) ⇒ Object
Instance Method Details
#dimensions(*dimensions) ⇒ Object
15 16 17 |
# File 'lib/ga4-rails/model.rb', line 15 def dimensions(*dimensions) @dimensions ||= dimensions end |
#metrics(*metrics) ⇒ Object
11 12 13 |
# File 'lib/ga4-rails/model.rb', line 11 def metrics(*metrics) @metrics ||= metrics end |
#results(access_token:, property_id:, start_date:, end_date:, limit: 1000) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ga4-rails/model.rb', line 19 def results(access_token:, property_id:, start_date:, end_date:, limit: 1000) client = Ga4Rails::Client.new(access_token: access_token) response = client.run_property_report( property_id: property_id, body: build_body(start_date: start_date, end_date: end_date, limit: limit) ).response beautify_response(response) end |