getUserAgent
The getUserAgent() method returns the default user agent string used by the SDK. If your app uses a WebView, set the same user agent there to improve tracking accuracy when cross-platform tracking is already set up. Setting the same user agent doesn’t enable visitor recognition on its own.
Syntax
tracker.getUserAgent()getTracker().getUserAgent();Returns
The default user agent string used by the SDK.
Type: String
Examples
To get the user agent and set it in a WebView for cross-platform visitor recognition:
val tracker: Tracker = (application as PiwikApplication).tracker
val userAgent = tracker.getUserAgent()
webView.settings.userAgentString = userAgentTracker tracker = ((PiwikApplication) getApplication()).getTracker();
String userAgent = tracker.getUserAgent();
webView.getSettings().setUserAgentString(userAgent);Related methods
Updated 15 days ago