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

Recommend client is incorrectly sending Search user agents #1507

Open
sarahdayan opened this issue Feb 14, 2024 · 4 comments
Open

Recommend client is incorrectly sending Search user agents #1507

sarahdayan opened this issue Feb 14, 2024 · 4 comments

Comments

@sarahdayan
Copy link
Member

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, because createUserAgent 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.

@Haroenv
Copy link
Contributor

Haroenv commented Feb 14, 2024

Algolia for JavaScript is still relevant for recommend, no?

@shortcuts
Copy link
Member

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

userAgent: createUserAgent(version)
.add({ segment: 'Recommend', version })
.add({ segment: 'Node.js', version: process.versions.node }),
};
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

@raed667
Copy link
Contributor

raed667 commented Feb 22, 2024

I guess the question boils down to:

Algolia for JavaScript = search or all frontend libraries

@shortcuts
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants