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
getTracker().getUserAgent();tracker.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:
Tracker tracker = ((PiwikApplication) getApplication()).getTracker();
String userAgent = tracker.getUserAgent();
webView.getSettings().setUserAgentString(userAgent);val tracker: Tracker = (application as PiwikApplication).tracker
val userAgent = tracker.getUserAgent()
webView.settings.userAgentString = userAgentRelated methods
Updated 4 days ago