Open sarahdayan opened 6 months ago
Algolia for JavaScript is still relevant for recommend, no?
The
createUserAgent
function shouldn't set "Algolia for JavaScript" by default. Instead, this agent should be added in the build of the Search client.
IMHO this segment can stay because what differentiates the clients are those next segments https://github.com/algolia/algoliasearch-client-javascript/blob/252228ab7c5d5c94890885e8ce9bb9b072905756/packages/recommend/src/builds/node.ts#L39-L42 added in the init directly
Keeping the Algolia for JavaScript
segment also allows us to track the global usage of the whole JavaScript API client
I guess the question boils down to:
Algolia for JavaScript
= search or all frontend libraries
All! It's clearer in the next major version as all clients can be used as standalone but it's mostly to identify the language associated to the API client for usage purposes, the other languages also have that notion
Actual
The Recommend client uses the same transporter utilities as the Search client, including the
createUserAgent
function. This causes it to set the "Algolia for JavaScript" user agent, which corresponds to Algolia Search, becausecreateUserAgent
sets this value by default. That's likely because the transporter was initially designed solely for the Search API, before Recommend existed.Additionally, the Recommend passes it its own version to
createUserAgent
, resulting in the Search client agent being sent with the Recommend client version.Expected
The Recommend client shouldn't send Algolia Search user agents at all.
Suggested solution
The
createUserAgent
function shouldn't set "Algolia for JavaScript" by default. Instead, this agent should be added in the build of the Search client.