Polarex.Metrics (Polarex v0.3.0)
View SourceProvides API endpoints related to metrics
Summary
Functions
Create Metric Dashboard
Delete Metric Dashboard
Export Metrics
Get Metrics
Get Metric Dashboard
Get Metrics Limits
List Metric Dashboards
Update Metric Dashboard
Types
@type t() :: %Polarex.Metrics{ active_subscriptions: Polarex.Metric.t() | nil, active_user_by_event: Polarex.Metric.t() | nil, annual_recurring_revenue: Polarex.Metric.t() | nil, average_order_value: Polarex.Metric.t() | nil, average_revenue_per_user: Polarex.Metric.t() | nil, average_seats_per_customer: Polarex.Metric.t() | nil, canceled_subscriptions: Polarex.Metric.t() | nil, canceled_subscriptions_customer_service: Polarex.Metric.t() | nil, canceled_subscriptions_low_quality: Polarex.Metric.t() | nil, canceled_subscriptions_missing_features: Polarex.Metric.t() | nil, canceled_subscriptions_other: Polarex.Metric.t() | nil, canceled_subscriptions_switched_service: Polarex.Metric.t() | nil, canceled_subscriptions_too_complex: Polarex.Metric.t() | nil, canceled_subscriptions_too_expensive: Polarex.Metric.t() | nil, canceled_subscriptions_unused: Polarex.Metric.t() | nil, cashflow: Polarex.Metric.t() | nil, checkouts: Polarex.Metric.t() | nil, checkouts_conversion: Polarex.Metric.t() | nil, churn_rate: Polarex.Metric.t() | nil, churned_seat_customers: Polarex.Metric.t() | nil, churned_subscriptions: Polarex.Metric.t() | nil, committed_annual_recurring_revenue: Polarex.Metric.t() | nil, committed_monthly_recurring_revenue: Polarex.Metric.t() | nil, committed_subscriptions: Polarex.Metric.t() | nil, cost_per_user: Polarex.Metric.t() | nil, costs: Polarex.Metric.t() | nil, cumulative_costs: Polarex.Metric.t() | nil, cumulative_revenue: Polarex.Metric.t() | nil, gross_margin: Polarex.Metric.t() | nil, gross_margin_percentage: Polarex.Metric.t() | nil, ltv: Polarex.Metric.t() | nil, monthly_recurring_revenue: Polarex.Metric.t() | nil, net_average_order_value: Polarex.Metric.t() | nil, net_cumulative_revenue: Polarex.Metric.t() | nil, net_revenue: Polarex.Metric.t() | nil, new_seat_customers: Polarex.Metric.t() | nil, new_subscriptions: Polarex.Metric.t() | nil, new_subscriptions_net_revenue: Polarex.Metric.t() | nil, new_subscriptions_revenue: Polarex.Metric.t() | nil, one_time_products: Polarex.Metric.t() | nil, one_time_products_net_revenue: Polarex.Metric.t() | nil, one_time_products_revenue: Polarex.Metric.t() | nil, orders: Polarex.Metric.t() | nil, renewed_subscriptions: Polarex.Metric.t() | nil, renewed_subscriptions_net_revenue: Polarex.Metric.t() | nil, renewed_subscriptions_revenue: Polarex.Metric.t() | nil, revenue: Polarex.Metric.t() | nil, seat_customers: Polarex.Metric.t() | nil, seat_utilization_rate: Polarex.Metric.t() | nil, seats_claimed: Polarex.Metric.t() | nil, seats_pending: Polarex.Metric.t() | nil, seats_total: Polarex.Metric.t() | nil, succeeded_checkouts: Polarex.Metric.t() | nil, trial_committed_monthly_recurring_revenue: Polarex.Metric.t() | nil, trial_monthly_recurring_revenue: Polarex.Metric.t() | nil }
Functions
@spec metrics_create_dashboard( body :: Polarex.MetricDashboardCreate.t(), opts :: keyword() ) :: {:ok, Polarex.MetricDashboardSchema.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Metric Dashboard
Create a user-defined metric dashboard.
Scopes: metrics:write
Request Body
Content Types: application/json
@spec metrics_delete_dashboard(id :: String.t(), opts :: keyword()) :: :ok | {:error, Polarex.HTTPValidationError.t()}
Delete Metric Dashboard
Delete a user-defined metric dashboard.
Scopes: metrics:write
@spec metrics_export(opts :: keyword()) :: {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
Export Metrics
Export metrics as a CSV file.
Scopes: metrics:read
Options
start_date: Start date.end_date: End date.timezone: Timezone to use for the timestamps. Default is UTC.interval: Interval between two timestamps.organization_id: Filter by organization ID.product_id: Filter by product ID.billing_type: Filter by billing type.recurringwill filter data corresponding to subscriptions creations or renewals.one_timewill filter data corresponding to one-time purchases.customer_id: Filter by customer ID.metrics: List of metric slugs to include in the export. If not provided, all metrics are exported.
@spec metrics_get(opts :: keyword()) :: {:ok, Polarex.MetricsResponse.t()} | {:error, Polarex.HTTPValidationError.t()}
Get Metrics
Get metrics about your orders and subscriptions.
Currency values are output in cents.
Scopes: metrics:read
Options
start_date: Start date.end_date: End date.timezone: Timezone to use for the timestamps. Default is UTC.interval: Interval between two timestamps.organization_id: Filter by organization ID.product_id: Filter by product ID.billing_type: Filter by billing type.recurringwill filter data corresponding to subscriptions creations or renewals.one_timewill filter data corresponding to one-time purchases.customer_id: Filter by customer ID.metrics: List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned.
@spec metrics_get_dashboard(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.MetricDashboardSchema.t()} | {:error, Polarex.HTTPValidationError.t()}
Get Metric Dashboard
Get a user-defined metric dashboard by ID.
Scopes: metrics:read
@spec metrics_limits(opts :: keyword()) :: {:ok, Polarex.MetricsLimits.t()} | :error
Get Metrics Limits
Get the interval limits for the metrics endpoint.
Scopes: metrics:read
@spec metrics_list_dashboards(opts :: keyword()) :: {:ok, [Polarex.MetricDashboardSchema.t()]} | {:error, Polarex.HTTPValidationError.t()}
List Metric Dashboards
List user-defined metric dashboards.
Scopes: metrics:read
Options
organization_id: Filter by organization ID.
@spec metrics_update_dashboard( id :: String.t(), body :: Polarex.MetricDashboardUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.MetricDashboardSchema.t()} | {:error, Polarex.HTTPValidationError.t()}
Update Metric Dashboard
Update a user-defined metric dashboard.
Scopes: metrics:write
Request Body
Content Types: application/json