DataDog / browser-sdk

Datadog Browser SDK
Apache License 2.0
291 stars 130 forks source link

🙏 How to customize device.type ? #2620

Closed arichard-info closed 1 month ago

arichard-info commented 6 months ago

Hello !

I have an application that is used directly on the web and also in a webview, in native applications (IOS and Android). I'm looking for the best way to identify this on datadog.

In the native application, the webview sets a custom user-agent : "app-android" or "app-ios". So I guess in device.type, this sessions are in "Other".

How can I identify these use cases ?

Is there a way to have device.type=app-android or device.type=app-ios ?

amortemousque commented 6 months ago

Hello @arichard-info, To my knowledge, we can't have custom device types. However, you could directly filter based on the user-agent: @session.useragent: app-android. Another approach could be to use the dedicated native IOS and Android SDKs which also allow to collect webview RUM data. Then you would be able to filter events coming from webviews like so: source:browser @os.name:iOS

arichard-info commented 6 months ago

Hi @amortemousque , thanks for your response ! @session.useragent should be available in Datadog ? I have device.type, browser, OS etc ... But I don't find the raw user-agent

bcaudan commented 6 months ago

Hi @arichard-info,

@session.useragent should be available in Datadog ?

It seems that the raw user agent is on the @session.useragent attribute on all events except session events and it is not documented 😕. We'll try to clarify that.

arichard-info commented 6 months ago

Hi @bcaudan

Thanks for your response If I understand well, i'm supposed to find the attribute @session.useragent here ? Screenshot 2024-03-11 at 11 07 02

I'm curious to have some documentation on this because I can't find it 😕

bcaudan commented 6 months ago

The attribute should be on the view events but there is no default facet on it, which prevent you from selecting it in the group by select.

From a view event side panel > attributes > JSON, you should be able to see the @session.useragent attribute and create a facet from it.