We have a requirement to pass browser, OS, Device details to third party analytics (yes they don't capture by default).
Does sitecore provides any API which we can use to capture these details? Any alternate approach is fine as well.
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityWe have a requirement to pass browser, OS, Device details to third party analytics (yes they don't capture by default).
Does sitecore provides any API which we can use to capture these details? Any alternate approach is fine as well.
Sitecore will capture information about the request in the analytics, but if you are just sending the data to the 3rd party analytics API you can probably just use the Request.Browser
object that is just part of the MVC Controller request.
You could use the following properties
public ActionResult MyRendering()
{
var os = Request.Browser.Platform;
var browserVersion = Request.Browser.Version;
// Parse the UserAgent yourself or use a 3rd party to parse:
var userAgent = Request.UserAgent;
}
If you don't get enough information from the properties, you could parse the UserAgent - use a service to give you consistent results. Something like: https://developers.whatismybrowser.com/
Sitecore offer access to the Device Detection API - you can use the class DeviceDetectionManager
and the method GetDeviceInformation
to get the device information such as:
For more information check this link: https://doc.sitecore.net/sitecore_experience_platform/developing/device_detection/api_reference_for_the_device_detection_service
If the other website is a Sitecore website as well, you could have a look at the federated experience manager: https://doc.sitecore.net/sitecore_experience_platform/digital_marketing/federated_experience_manager/the_federated_experience_manager
If not, I would build a simple Web API which exposes the Sitecore.Analytics database to the other website.
Edit: I wouldn't choose to send the analytics on every page load. When the external API is slow, your website gets slow as well.