Setting BR_Lang in an web application

Hi, I’m looking for a good way to set the br_lang field on the application side when a user selects a different language in my application.

I was able to get it changed by setting navigator.userLanguage when the tracker is initialized, but since that sets the browserLanguage object once and doesn’t recheck it, if the user changes their language after the tracker is initialized the tracker doesn’t pick up the change.

Any ideas on how to get this to work?

Hi @nicka,

The br_lang field cannot be updated at the moment, as you have already discovered. It is set when the tracker first loads, and there is no way to override it afterwards.

If user-selected language is import to you, then you can track it using a custom context. Check out the javascript documentation about custom contexts and in particular about global contexts for attaching your context to all events.

If you would still like br_lang itself to be dynamically configurable, then you can open an issue in github with this suggested improvement.

Hopefully that helps

1 Like