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

Allow configuration of custom userAgent #268

Merged
merged 1 commit into from
Nov 16, 2023
Merged

Conversation

hbmartin
Copy link
Contributor

We've encountered a need to configure a custom user agent for app. This PR enables setting that with a new field in Configuration

@bsneed
Copy link
Contributor

bsneed commented Nov 16, 2023

Hi @hbmartin, thanks for the contribution. I think something like this is better done as a user-defined plugin. Something alone the lines of this in it's simplest form.

analytics.add(enrichment: { event in
    event.context["userAgent"] = "myUserAgentString"
})

What do you think? I'm not opposed to your change, but it adds core functionality that the plugin system is meant to address.

@hbmartin
Copy link
Contributor Author

@bsneed If I understand correctly, the big difference between this PR and the plugin approach is that the async work to get the device user agent would still happen and only later be overwritten by the plugin value. We would like to avoid that work entirely when setting a custom UA. (If I'm incorrect then happy to use the plugin!)

@bsneed
Copy link
Contributor

bsneed commented Nov 16, 2023

Ah, that's a great point. Merge underway. I've got another release in the works and it'll go out with that.

@bsneed bsneed merged commit f1bf66a into segmentio:main Nov 16, 2023
1 of 7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants