Session length distribution
Get the number of sessions for each pre-defined length (bucket
) period during a specified date range.
timeHistogramConfigBin Format
timeHistogramConfigBinTimeUnit is any of ['hours', 'minutes', 'seconds'].
In order to take advantage of custom binning, timeHistogramConfigBinMin, timeHistogramConfigBinMax, and timeHistogramConfigBinTimeUnit must be specified. When timeHistogramConfigBinSize is not specified, Amplitude will try to determine the optimum bin sizing. For example, if we have timeHistogramConfigBinMin=0, timeHistogramConfigBinMax=10, and timeHistogramConfigBinTimeUnit=minutes, there is no guarantee regarding the final amount of bins or bin bounds. If timeHistogramConfigBinSize=1 is specified, 10 bins would be guaranteed, with each bin size equaling a minute.
When combined timeHistogramConfigBin parameters are invalid/missing, Amplitude will default to use default bins that are chosen because they approximate certain behaviors such as bounce rate. These bins are (in milliseconds): [0, 3000), [3000, 10,000), [10,000, 30,000), [30,000, 60,000), [60,000, 180,000), [180,000, 600,000), [600,000, 1,800,000), [1,800,000, 3,600,000), [3,600,000, 86,400,000).
Session lengths are bounded at a maximum of 1 day (86,400,000 ms).
Returns
| Attribute | Description | 
|---|---|
| series | An array with one element which is itself an array that contains the counts (number of sessions) for each of the buckets. | 
| xValues | An array of the (string) session length intervals (buckets) of the format [bucketStartInSeconds]s-[bucketEndInSeconds]s. | 
Request Params
| Key | Datatype | Required | Description | 
|---|---|---|---|
| start | null | Required. First date included in data series, formatted YYYYMMDD (e.g. "20141001"). | |
| end | null | Required. Last date included in data series, formatted YYYYMMDD (e.g. "20141004"). | |
| timeHistogramConfigBinTimeUnit | null | Optional. Time unit for bucket sizes (see below for valid inputs). | |
| timeHistogramConfigBinMin | null | Optional. Minimum value for bucketing, as number (e.g. "0"). | |
| timeHistogramConfigBinMax | null | Optional. Maximum value for bucketing, as number (e.g. "600"). | |
| timeHistogramConfigBinSize | null | Optional. Size of each bucket, as number (e.g. "60"). | 
RESPONSES
status: OK
{"withSets":true,"data":{"xValues":["0s-3s","3s-10s","10s-30s","30s-60s","60s-180s","180s-600s","600s-1800s","1800s-3600s","3600s-86400s"],"series":[[11,4,2,4,4,6,2,3,0]],"seriesLabels":[0]},"timeComputed":1643750153702,"wasCached":false,"cacheFreshness":"FRESH","novaRuntime":402,"novaRequestDuration":435,"novaCost":15,"throttleTime":1,"minSampleRate":1,"transformationIds":[],"backend":"novaV2","realtimeDataMissing":false,"timedOutRealtimeData":false,"partialMergedAndNewUserInformation":false,"prunedResult":false,"hitChunkGroupByLimit":false,"subcluster":6,"millisSinceComputed":6,"queryIds":["Pg4CUaNyOK"]}