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
feat: add Klarna Shopping Browser UA parser #669
feat: add Klarna Shopping Browser UA parser #669
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The detection for Apps that's not primarily used as a browser will be migrated here forward:
https://github.com/faisalman/ua-parser-js/blob/master/src/extensions/ua-parser-extensions.js#L20
@faisalman hm but Klarna app is positioned as Shopping Browser, it has URL address bar etc. Attached a screenshot of how it looks. Would that still count as non browser? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.. with an address bar it surely looks like a browser
Hey @faisalman, thanks for merging this PR! Is this going to v1 or v2? |
v2, but might as well backported to v1 later |
@faisalman how can we add this to v1? |
In the mean time, you can pass it as an extension when instantiating UAParser const browsers = [
[/(klarna)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]
];
const parser = new UAParser({ browser: browsers });
const ua = 'Mozilla/5.0 (Linux; Android 12; moto g(60)s Build/S3RLS32.114-25-13; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 Klarna/23.36.215';
uap.setUA(ua).getBrowser(); // { name: 'Klarna', version: '23.36.215', major: '23'} More details at https://docs.uaparser.js.org/v2/intro/extending-regex.html |
…d from commit 177a496) Co-authored-by: Ilya Daraseliya <ilya.daraseliya@klarna.com>
Klarna App with 150 million users is rather popular shopping browser.
Adding support for Klarna UA parser.