To enable location tracking via the Braze Web SDK, call
This will cause the Braze Web SDK to continuously collect the user’s location (in browsers that support it), whenever your site is visible in the foreground of the user’s browser. This location collection will continue for the duration of the page load (you should call this method for each page on which you want location to be tracked). Note that calling this will immediately request permission from the user, unless they have already granted or denied permission. See the JSDocs for more information.
Logging A Single Location
To manually set a user’s last known location yourself, you can use
1 appboy.getUser().setLastKnownLocation(latitude, longitude, accuracy, altitude, altitudeAccuracy);
See the JSDocs for more information.
Additionally, when the Web SDK sends data to Braze servers, the user’s country will be automatically detected from their IP Address if it has not been manually set by your application.