Customer Count

GET https://api.chartmogul.com/v1/metrics/customer-count

Retrieves the number of active customers, for the specified time period.

curl -X GET "https://api.chartmogul.com/v1/metrics/customer-count" \
     -u YOUR_API_KEY: \
     -d start-date=2023-07-01 \
     -d end-date=2023-08-31 \
     -d interval=month \
     -d geo=US \
     -d plans=Silver%20Monthly
ChartMogul::Metrics.customer_count(
  start_date: "2023-07-01",
  end_date: "2023-08-31",
  interval: "month",
  geo: "US",
  plans: "Silver Monthly",
)
ChartMogul.Metrics.customerCount(config, {
  "start-date": "2023-07-01",
  "end-date": "2023-08-31",
  interval: "month",
  geo: "US",
  plans: "Silver Monthly",
});
ChartMogul\Metrics::customerCount([
  "start-date" => "2023-07-01",
  "end-date" => "2023-08-31",
  "interval" => "month",
  "geo" => "US",
  "plans" => "Silver Monthly"
]);
api.MetricsRetrieveCustomerCount(&cm.MetricsFilter{
  StartDate: "2023-07-01",
  EndDate:   "2023-08-31",
  Interval:  "month",
  Geo:       "US",
  Plans:     "Silver Monthly",
})
chartmogul.Metrics.customer_count(
  config,
  start_date="2023-07-01",
  end_date="2023-08-31",
  interval="month",
  geo="US",
  plans="Silver Monthly",
)
{
  "entries": [
    {
      "date": "2023-07-31",
      "customers": 379,
      "percentage-change": 0.0
    },
    {
      "date": "2023-08-31",
      "customers": 382,
      "percentage-change": 0.8
    }
  ],
  "summary": {
    "current": 382,
    "previous": 379,
    "percentage-change": 0.8
  }
}
#<ChartMogul::Metrics::CustomerCounts:0x007fa4ec4605d0 
@entries=[
  #<ChartMogul::Metrics::CustomerCount:0x007fa4ec4602d8 
    @date=2023-07-31, 
    @customers=379,
    @percentage_change=0.0
  >,
  #<ChartMogul::Metrics::CustomerCount:0x007fa4ec4602d8 
    @date=2023-08-31, 
    @customers=382,
    @percentage_change=0.8
  >
], 
@summary=
  #<ChartMogul::Summary:0x007fa4ec45a338
    @current=382,
    @previous=379,
    @percentage_change=0.8
  >
>
{
  entries: [
    {
      date: "2023-07-31",
      customers: 379,
      "percentage-change": 0.0
    },
    {
      date: "2023-08-31",
      customers: 382,
      "percentage-change": 0.8
    }
  ],
  summary: {
    current: 382,
    previous: 379,
    "percentage-change": 0.8
  }
}
ChartMogul\Metrics\CustomerCounts::__set_state(array(
  "entries" => Doctrine\Common\Collections\ArrayCollection::__set_state(array(
    "elements" => array(
      0 => ChartMogul\Metrics\CustomerCount::__set_state(array(
        "date" => "2023-07-31",
        "customers" => 379,
        "percentage_change" => 0.0
      )),
      1 => ChartMogul\Metrics\CustomerCount::__set_state(array(
        "date" => "2023-08-31",
        "customers" => 382,
        "percentage_change" => 0.8
      ))
    )
  )),
  "summary" => ChartMogul\Summary::__set_state(array(
    "current" => 382,
    "previous" => 379,
    "percentage_change" => 0.8
  ))
));
(*chartmogul.CustomerCountResult)(0xc0420c8ba0)({
  Entries: ([]*chartmogul.CustomerCountMetrics) (len=2) {
    (*chartmogul.CustomerCountMetrics)(0xc04200a480)({
      Date: (string) (len=10) "2023-07-31",
      Customers: (uint32) 379,
      PercentageChange: (float64) 0
    }),
    (*chartmogul.CustomerCountMetrics)(0xc04200a4e0)({
      Date: (string) (len=10) "2023-08-31",
      Customers: (uint32) 382,
      PercentageChange: (float64) 0.8
    })
  },
  Summary: (*chartmogul.Summary)(0xc04200a520)({
    Current: (float64) 382,
    Previous: (float64) 379,
    PercentageChange: (float64) 0.8
  })
})
Metrics(
  entries=[
    <Metrics{
      customers=379.0,
      percentage_change=0.0,
      date=datetime.date(2023, 7, 31)
    }>, 
    <Metrics{
      customers=382.0,
      percentage_change=0.8,
      date=datetime.date(2023, 8, 31)
    }>
  ], 
  summary=<Summary{
    current=382.0, 
    percentage_change=0.8, 
    previous=379.0
  }>
)

Query parameters

start-date datetime required
The start date of the required period of data. An ISO-8601 formatted date, e.g. 2015-05-12
end-date datetime required
The end date of the required period of data. An ISO-8601 formatted date, e.g. 2015-05-12
interval string default: "month"
One of day, week, month (default), or quarter
geo string
A comma-separated list of ISO 3166-1 Alpha-2 formatted country codes to filter the results to, e.g. US,GB,DE.
plans string
A comma-separated list of plan names (as configured in your ChartMogul account), UUIDs and external IDs to filter the results. Spaces in plan names must be URL-encoded (e.g., Silver%20plan,Gold%20plan,Enterprise%20plan). Plan UUIDs are accepted with or without the pl_ prefix (e.g., pl_ca7565ce-1973-9351-11ee-9f34ab5816d8,b35fdb9e-1ca2-11ee-90be-6f197565b760). Plan names and IDs are case-sensitive. You can mix plan names, UUIDs and external IDs in a single string, (e.g., Silver%20plan,pl_ca7565ce-1973-9351-11ee-9f34ab5816d8,gold_plan).

Response

In the response, the entries key contains an object for each interval, with the following data:

date
The date of the end of the interval
customers
The number of active customers in your account as at the end of the interval.
percentage-change
The percentage change between the current active customers and active customers from the previous time interval. Will be set to 0.0 if this is the first entry in the response.

The summary key contains the current Customer Count value, the value 30 days ago, and the percentage change between these two measures.