- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
03-27-2018 02:28 AM
I want to include the full User Agent string in my datalayer.
I can read it can be seen by using "navigator.userAgent" but what is the best way to include this in the datalayer. I had actuel expected it would be a part of the tealium data set automatic tracked on the page (as DOM, Meta data etc is)
We have been using Webtrends and here it was automatic send by the tag. But it does not seems this is the case for Adobe Analytics. So now we would like to send it in a eVar.
Solved! Go to Solution.
03-27-2018 02:55 AM - edited 03-27-2018 02:56 AM
I've not seen a better approach than using a Set Data Values extension to grab the following useful properties from the navigator API:
If you want to be lazy and do it in pure JS, something like this would work:
["doNotTrack","language","userAgent","maxTouchPoints"].map((v) => b["nav." + v.toLowerCase()] = String(window.navigator[v]));
(might want to run it through Babel to de-ES6 it)
It populates the following UDO elements:
From their respective navigator properties.
03-27-2018 03:13 AM
03-27-2018 03:15 AM
03-27-2018 06:50 AM
OOOooooooo @rune_a. I'd mark that as an accepted solution. #hinthint #winkwink
04-09-2018 12:16 PM
I'm late to this party, @rune_a, but what's the real thing you want to solve? Reporting the user agent value in Adobe Analytics or getting the UA into the data layer (UDO) for other reasons?
If you just want to get the UA into an Adobe Analytics eVar, I would recommend using Processing Rules to do it from within Adobe Analytics Report Suite configuration. The only possible snag there is if no one on the team is Processing Rules certified. But that's easy enough to do in a short time, and it's beneficial to get that certification anyway as it opens many doors.
Looking forward to continuing this discussion.... cheers!
04-10-2018 12:48 PM
Thanks @mitchellt - i had not even considered this was a option in Processing Rules. But i see it, and have tried to add it.
Sometime the obvious solution is to easy to be considered.
In general i like to have the User Agent available in a analytics dataset for debugging.
Copyright All Rights Reserved © 2008-2023