Sha256: 784ea479c066d463bc942133fa238230bce5a2376cf46cd05dbc67bb84f957e9

Contents?: true

Size: 467 Bytes

Versions: 2

Compression:

Stored size: 467 Bytes

Contents

# frozen_string_literal: true

module PlausibleApi
  module Stats
    class Aggregate < Base

      def initialize(options = {})
        super({ period: '30d', 
                metrics: 'visitors,pageviews,bounce_rate,visit_duration' }
              .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.1.9 lib/plausible_api/stats/aggregate.rb
plausible_api-0.1.8 lib/plausible_api/stats/aggregate.rb