syntax = "proto3";

package devvit.analytics.v1;

import "google/protobuf/timestamp.proto";

option go_package = "github.snooguts.net/reddit/devplatform-api/go/grpc/devvit/analytics/v1";

// The Devvit Analytics API provides analytics data on a per-app basis.
service DevvitAnalyticsService {
  rpc GetAnalyticsByApp(GetAnalyticsByAppRequest) returns (GetAnalyticsByAppResponse);
}

message GetAnalyticsByAppRequest {
  string app_slug = 1;
  google.protobuf.Timestamp start_date = 2;
  google.protobuf.Timestamp end_date = 3;
}

message GetAnalyticsByAppResponse {
  repeated DailyAppAnalytics daily_analytics = 1;
}

message DailyAppAnalytics {
  google.protobuf.Timestamp date = 1;
  int64 unique_clickers = 2;
  // Deprecated: unused by consumers
  int64 unique_viewers = 3 [deprecated = true];
  // Deprecated: unused by consumers
  int64 total_clicks = 4 [deprecated = true];
  // Deprecated: unused by consumers
  int64 total_views = 5 [deprecated = true];
  int64 qualified_installs = 6;
  // Deprecated: no longer used; prefer qualified_installs and engagement metrics.
  int64 lifetime_clicks = 7 [deprecated = true];
  // total number of good visits across the app's custom posts on the day
  int64 total_good_visits = 8;
  // count of unique users with good visits on the day
  int64 unique_good_visitors = 9;
  // avg count of unique users with good visits per day over the past 14 days
  double unique_good_visitors_14_day_avg = 10;
}
