Skip to content

Commit

Permalink
Merge pull request #308 from rudderlabs/production-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
arnab-p authored Aug 17, 2021
2 parents 3a03dc0 + 782e6c4 commit de5d618
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/RudderContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ class RudderContext {
screen.width = window.screen.width;
screen.height = window.screen.height;
screen.density = window.devicePixelRatio;
this.userAgent = navigator.userAgent;
// detect brave browser and append to the user agent
if (navigator.brave && Object.getPrototypeOf(navigator.brave).isBrave) {
const version = navigator.userAgent.match(/(Chrome)\/([\w\.]+)/i)[2];
this.userAgent = `${navigator.userAgent} Brave/${version}`;
} else {
this.userAgent = navigator.userAgent;
}
// property name differs based on browser version
this.locale = navigator.language || navigator.browserLanguage;
screen.innerWidth = window.innerWidth;
Expand Down

0 comments on commit de5d618

Please sign in to comment.