Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(specs): Review OpenAPI Analytics (search analytics) #1689

Merged
merged 21 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 59 additions & 17 deletions specs/analytics/common/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
Attribute:
in: path
name: attribute
description: The exact name of the attribute.
description: Attribute name.
required: true
schema:
type: string
example: 'brand'

# query
OrderBy:
Expand All @@ -18,13 +19,18 @@ OrderBy:
# private
orderBy:
type: string
description: >
Method for ordering results.

`clickThroughRate`, `conversionRate` and `averageClickPosition` are only available if the `clickAnalytics` parameter is `true`.
enum: [searchCount, clickThroughRate, conversionRate, averageClickPosition]
default: searchCount

Direction:
in: query
name: direction
description: The sorting of the result.
description: >
Sorting direction of the results: ascending or descending.
schema:
$ref: '#/direction'

Expand All @@ -37,73 +43,109 @@ direction:
ClickAnalytics:
in: query
name: clickAnalytics
description: Whether to include the click-through and conversion rates for a search.
description: Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search.
schema:
type: boolean
default: false

count:
description: Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`).
type: integer
example: 504

noResultCount:
description: Number of occurences.
type: integer
example: 54

Search:
in: query
name: search
description: The query term to search for. Must match the exact user input.
description: User query.
example: 'enable ab test'
schema:
type: string

Offset:
in: query
name: offset
description: Start position for retrieving results.
example: 1
schema:
type: integer
minimum: 0

Tags:
name: tags
in: query
description: Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
description: Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
example: 'device:mobile%20phone'
schema:
type: string

# misc
average:
type: number
format: double
description: The average of all the click count event.
description: Average count of all click events.

averageClickPosition:
type: integer
description: The average position of all the click count event.
description: Average [position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) of clicked search result.
example: 1

clickCount:
type: integer
description: The number of click event.
description: Number of click events.
example: 162

date:
type: string
description: Date of the event.
description: Date of the event in the format YYYY-MM-DD.
example: '2023-06-14'

rate:
type: number
format: double
description: The click-through rate.
description: >
[Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).
minimum: 0
maximum: 1
example: 0.14634193523426317

conversionRate:
type: number
format: double
description: The conversion rate.
description: >
[Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).
example: 0

conversionCount:
type: integer
description: The number of converted clicks.
description: Number of converted clicks.
example: 0

attribute:
description: The attribute.
description: Attribute name.
type: string
example: 'url'

operator:
description: The operator.
description: Operator.
type: string
example: ':'

value:
description: The value of the attribute.
description: Attribute value.
type: string
example: 'integration'

search:
description: The search query.
description: User query.
example: 'separator'
type: string

hit:
description: The hit.
description: Hit.
type: string
example: 'method-export-rules-php'
2 changes: 1 addition & 1 deletion specs/analytics/common/schemas/getTopFilterAttributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ getTopFilterAttributesResponse:
properties:
attributes:
type: array
description: A list of attributes with their count.
description: Filterable attributes.
items:
$ref: '#/getTopFilterAttribute'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ getTopFilterForAttributeResponse:
properties:
values:
type: array
description: A list of filters for the given attributes.
description: Filter values for an attribute.
items:
$ref: '#/getTopFilterForAttribute'

Expand Down
4 changes: 2 additions & 2 deletions specs/analytics/common/schemas/getTopFiltersNoResults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ getTopFiltersNoResultsResponse:
properties:
values:
type: array
description: A list of filters without results.
description: Filters with no results.
items:
$ref: '#/getTopFiltersNoResultsValues'

Expand All @@ -21,7 +21,7 @@ getTopFiltersNoResultsValues:
$ref: '../../../common/parameters.yml#/count'
values:
type: array
description: A list of filters without results.
description: Filters with no results.
items:
$ref: '#/getTopFiltersNoResultsValue'

Expand Down
4 changes: 2 additions & 2 deletions specs/analytics/common/schemas/getTopHits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ topHitsResponse:
properties:
hits:
type: array
description: A list of top hits with their count.
description: Top hits.
items:
type: object
title: topHit
Expand All @@ -28,7 +28,7 @@ topHitsResponseWithAnalytics:
properties:
hits:
type: array
description: A list of top hits with their count and analytics.
description: Top hits.
items:
type: object
title: topHitWithAnalytics
Expand Down
8 changes: 4 additions & 4 deletions specs/analytics/common/schemas/getTopSearches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ topSearchesResponse:
properties:
searches:
type: array
description: A list of top searches with their count.
description: Top searches with their hits count.
items:
type: object
title: topSearch
Expand All @@ -19,7 +19,7 @@ topSearchesResponse:
search:
$ref: '../parameters.yml#/search'
count:
$ref: '../../../common/parameters.yml#/count'
$ref: '../parameters.yml#/count'
nbHits:
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'

Expand All @@ -31,7 +31,7 @@ topSearchesResponseWithAnalytics:
properties:
searches:
type: array
description: A list of top searches with their count and analytics.
description: Top searches with their hits count and analytics.
items:
type: object
title: topSearchWithAnalytics
Expand All @@ -50,7 +50,7 @@ topSearchesResponseWithAnalytics:
search:
$ref: '../parameters.yml#/search'
count:
$ref: '../../../common/parameters.yml#/count'
$ref: '../parameters.yml#/count'
clickThroughRate:
$ref: '../parameters.yml#/rate'
averageClickPosition:
Expand Down
6 changes: 3 additions & 3 deletions specs/analytics/paths/search/getNoClickRate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ get:
- search
operationId: getNoClickRate
summary: Get no click rate.
description: Returns the rate at which searches didn't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks.
description: Returns the rate at which searches don't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks.
parameters:
- $ref: '../../../common/parameters.yml#/Index'
- $ref: '../../../common/parameters.yml#/StartDate'
Expand Down Expand Up @@ -32,7 +32,7 @@ get:
$ref: '../../common/parameters.yml#/clickCount'
dates:
type: array
description: A list of searches without clicks with their date, rate and counts.
description: Overall count of searches without clicks plus a daily breakdown.
items:
type: object
title: noClickRateEvent
Expand All @@ -46,7 +46,7 @@ get:
rate:
$ref: '../../common/parameters.yml#/rate'
count:
$ref: '../../common/parameters.yml#/clickCount'
$ref: '../../common/parameters.yml#/count'
noClickCount:
$ref: '../../common/parameters.yml#/clickCount'
date:
Expand Down
8 changes: 4 additions & 4 deletions specs/analytics/paths/search/getNoResultsRate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ get:
- search
operationId: getNoResultsRate
summary: Get no results rate.
description: Returns the rate at which searches didn't return any results. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without results used to compute the rates.
description: Returns the rate at which searches didn't return any results.
parameters:
- $ref: '../../../common/parameters.yml#/Index'
- $ref: '../../../common/parameters.yml#/StartDate'
Expand Down Expand Up @@ -32,7 +32,7 @@ get:
$ref: '../../../common/parameters.yml#/count'
dates:
type: array
description: A list of searches without results with their date, rate and counts.
description: Overall count of searches without results plus a daily breakdown.
items:
type: object
title: noResultsRateEvent
Expand All @@ -46,9 +46,9 @@ get:
date:
$ref: '../../common/parameters.yml#/date'
noResultCount:
$ref: '../../../common/parameters.yml#/count'
$ref: '../../common/parameters.yml#/noResultCount'
count:
$ref: '../../../common/parameters.yml#/count'
$ref: '../../common/parameters.yml#/count'
rate:
$ref: '../../common/parameters.yml#/rate'
'400':
Expand Down
6 changes: 3 additions & 3 deletions specs/analytics/paths/search/getSearchesCount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ get:
tags:
- search
operationId: getSearchesCount
summary: Get searches count.
description: Returns the number of searches across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day.
summary: Get number of searches.
description: Returns the number of searches within a time range.
parameters:
- $ref: '../../../common/parameters.yml#/Index'
- $ref: '../../../common/parameters.yml#/StartDate'
Expand All @@ -26,7 +26,7 @@ get:
$ref: '../../../common/parameters.yml#/count'
dates:
type: array
description: A list of search events with their date and count.
description: Search events with their associated dates and hit counts.
items:
type: object
title: searchEvent
Expand Down
4 changes: 2 additions & 2 deletions specs/analytics/paths/search/getSearchesNoClicks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ get:
- search
operationId: getSearchesNoClicks
summary: Get top searches with no clicks.
description: Returns top searches that didn't lead to any clicks. Limited to the 1000 most frequent ones. For each search, also returns the average number of found hits.
description: Return the most popular of the last 1,000 searches that didn't lead to any clicks.
parameters:
- $ref: '../../../common/parameters.yml#/Index'
- $ref: '../../../common/parameters.yml#/StartDate'
Expand All @@ -25,7 +25,7 @@ get:
properties:
searches:
type: array
description: A list of searches with no clicks and their count.
description: Searches with no clicks.
items:
type: object
title: searchNoClickEvent
Expand Down
4 changes: 2 additions & 2 deletions specs/analytics/paths/search/getSearchesNoResults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ get:
- search
operationId: getSearchesNoResults
summary: Get top searches with no results.
description: Returns top searches that didn't return any results. Limited to the 1000 most frequent ones.
description: Returns the most popular of the latest 1,000 searches that didn't return any results.
parameters:
- $ref: '../../../common/parameters.yml#/Index'
- $ref: '../../../common/parameters.yml#/StartDate'
Expand All @@ -25,7 +25,7 @@ get:
properties:
searches:
type: array
description: A list of searches with no results and their count.
description: Searches with no results.
items:
type: object
title: searchNoResultEvent
Expand Down
7 changes: 4 additions & 3 deletions specs/analytics/paths/search/getTopCountries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ get:
- search
operationId: getTopCountries
summary: Get top countries.
description: Returns top countries. Limited to the 1000 most frequent ones.
description: Returns top countries. Limited to the 1,000 most frequent ones.
parameters:
- $ref: '../../../common/parameters.yml#/Index'
- $ref: '../../../common/parameters.yml#/StartDate'
Expand All @@ -25,7 +25,7 @@ get:
properties:
countries:
type: array
description: A list of countries with their count.
description: Countries
items:
type: object
title: topCountry
Expand All @@ -35,8 +35,9 @@ get:
- count
properties:
country:
description: The country.
description: Country.
type: string
example: 'UK'
count:
$ref: '../../../common/parameters.yml#/count'
'400':
Expand Down
Loading