Trying to capture Device Type and Browser Language as Emdedded Data | XM Community
Solved

Trying to capture Device Type and Browser Language as Emdedded Data

  • 26 February 2018
  • 18 replies
  • 908 views

The two types of information I'm missing from the 'Meta Info Question' is the 'Device Type' (Desktop, Tablet, Phone) and the Browser Language. I was able to capture that information using JavaScript in another survey tool but we're transitioning to Qualtrics, and I've had no luck with so far.
icon

Best answer by TomG 14 March 2018, 21:08

View original

18 replies

Userlevel 7
Badge +27
If you define the embedded data variable Q_Language in the survey flow, it will always have the current language.

You can pipe the Operating System and Screen Resolution from a MetaInfo question into a JavaScript and parse it to determine if it is a Desktop, Tablet, or Phone.
Userlevel 4
Badge +5
Also, using the "UserAgent" built in Qualtrics variable... this will capture which browser they are using and which version. Also, this usually will hint at whether they were on mobile. Example of what the UserAgent variable will give you - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
Hi all,
I have notice there are differences between metadata and useragent information
○ Not same information in browser vs UserAgent
○ Version unknown when more info is given in UserAgent
○ More information possible in Operating system (as per UserAgent)
Have you experience something similar?
Thanks,
Cristina
I too am transitioning from another survey tool (where I had no trouble determining the device type and language) to Qualtrics and am interested in capturing the device type and browser language. Based on the online documentation I have seen, my understanding is that Q_Language represents the language in which we are viewing the survey. What I am trying to determine is the default language the survey-taker's browser is configured for.

Also, since my organization is running on the JFE survey engine, I'm not able to get anything from the Browser Meta Info question (I'm certain what "pipe the Operating System and Screen Resolution from a MetaInfo question into a JavaScript and parse" means) and have to rely on the built-in UserAgent embedded data element. My problem however, is that I cannot find any information explaining how to parse the resultant text string.

Does anyone have some insight to this?
Userlevel 7
Badge +27
JFE has no impact on the MetaInfo question. The MetaInfo question pretty much parses the UserAgent string for you. Let's say your MetaInfo question is QID1, then to pipe the Browser (the first thing in the MetaInfo question) would be ${q://QID1/ChoiceTextEntryValue/1}. You can easily find the correct pipe string by clicking on some question text in the editor, then selecting Piped Text.../Survey Question/{your MetaInfo question}/{the MetaInfo you want} (Text Entry).

MetaInfo doesn't include browser language. The best way to do that is debatable:
https://stackoverflow.com/questions/1043339/javascript-for-detecting-browser-language-preference
Thanks TomG. I guess I didn't understand how to use the Browser Meta Info question. I thought that the values captured would show up in the response data immediately (mine are all blank). So I will have to create embedded data elements for the attributes I want to capture and pipe-in information from the Browser Meta Info question?

Still being a newbie to this platform, how (and where) exactly would I go about installing my own JavaScript?
Userlevel 7
Badge +27
The MetaInfo being blank in the response data doesn't sound right (unless it was generated test responses). I use it all the time and have never run into that. Make sure your survey flow logic isn't skipping the block with the MetaInfo question in it.

Generally, you add JavaScript to a question by clicking on the cog to the left of the question. If you want to add an external JavaScript library, you would add the script tag to the survey header or footer under Look & Feel.

TomG , we forgot to add device type conditions in survey flow can we now check wether respondent device type was mobile or desktop.

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/27585#Comment_27585If you included a MetaInfo question or UserAgent embedded data field (you would have to decode UserAgent). Otherwise, you are probably out of luck.

TomG , i have added UserAgent but it is no in readable format. how can i use this to punch device type.

Will it work if we punch like if (UserAgent CONTAINS Mobile) punch Device as MOBILE else Desktop

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/27590#Comment_27590I don't think that will be reliable. It will get a subset of mobile devices but not all of them. I'm not sure what percent. For accuracy, you need to look them up using something like browscap.

Sorry can you explain more what is browscap

response is like :Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36

Userlevel 7
Badge +27

browscap is a database of user agents.
Using their lookup tool, the user agent string you posted is:
Chrome 83.0 64-bit running on Windows 10

Userlevel 5
Badge +11

Thanks TomG. I guess I didn't understand how to use the Browser Meta Info question. I thought that the values captured would show up in the response data immediately (mine are all blank). So I will have to create embedded data elements for the attributes I want to capture and pipe-in information from the Browser Meta Info question?

Still being a newbie to this platform, how (and where) exactly would I go about installing my own JavaScript?

@Chris_M no one has mentioned it yet so thought I’d chime in, it’s likely that they are blank because you need to retrieve these fields after a page break.  Just ran into that problem myself.

 

Hi @TomG,  late to the party here but are we saying using the Device Type in the display logic of a survey is not going to be 100%?

I’m about to deploy in infographic for desktop and another infographic for mobile and was going to use the device type display logic instead of trying to parse the width pixels value from the metadata fields.

 

Thanks

 

Rod Pestell

Userlevel 7
Badge +27

@Rod_Pestell,

Device Type isn’t very effective for determining how to display something. Smartphones, tablets and desktops all come in a variety of overlapping screen sizes. The good news is you don’t need to parse the metadata fields.  Using JS  you can easily get the screen size or the dimensions of html elements. Screen is screen.width. To get the width of a Qualtrics question: jQuery(this.questionContainer).width();

Userlevel 5
Badge +11

Hi @TomG 

Thanks for that.  What screen resolution would you say is the nominal width you’d say represents a mobile?  I’ll work backwards from there then as we use a static theme which reduces the width slightly.

 

Thanks

 

Rod Pestell

Userlevel 7
Badge +27

Hi @TomG 

Thanks for that.  What screen resolution would you say is the nominal width you’d say represents a mobile?  I’ll work backwards from there then as we use a static theme which reduces the width slightly.

 

Thanks

 

Rod Pestell

480px. That’s what Qualtrics uses in their CSS media rules.

Leave a Reply