Sha256: 70769ba7dc0775e2c09642f82fb9ac3720a9558651afe558dc50fc43d8131b23

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

module PlausibleApi
  module Stats
    class Aggregate < Base

      def initialize(options = {})
        super({ period: '30d', 
                metrics: 'visitors,visits,pageviews,views_per_visit,bounce_rate,visit_duration,events' }
              .merge(options))
      end
      
      def request_url_base
        "/api/v1/stats/aggregate?site_id=$SITE_ID"
      end

      def parse_response(body)
        JSON.parse(body)['results']
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plausible_api-0.2 lib/plausible_api/stats/aggregate.rb
plausible_api-0.1.10 lib/plausible_api/stats/aggregate.rb