How do retrieve embedded data from website? | XM Community
Skip to main content

Hi all,

 

I would like to seek help from the community.

 

I am trying to set up a website feedback survey where our employees can log in their issues that they encounter from the website. There will be ticketing system and one of the embedded data that we would like to get is their email address.

 

We would like to get the email address directly from the website because we do not have to get our employees to manually log their email address into the survey and we are keeping the survey questions lean.

 

The email address is actually retrievable from the website ‘Inspect’ page under the ‘Application’ tab and the  key is named as EmailID along with its Value (Email address).

 

How do i build this into Qualtrics survey? Do i use Web Service (Under Survey Flow) or do I just add ‘Embedded Data’ into the Branch in Survey Flow?

 

Your advice is appreciated!

Hi Yuka, 

You could try this:

Extract EmailID using JavaScript (if it’s stored in the browser)

You can embed JavaScript into the first question of the survey to grab that and set it as embedded data. Example (for localStorage):

Qualtrics.SurveyEngine.addOnload(function() { var email = localStorage.getItem("EmailID"); Qualtrics.SurveyEngine.setEmbeddedData("EmailID", email); });

Then, in Survey Flow, add an Embedded Data block named EmailID to store that value.


Hi @KelliPolk,

 

Thank you for your help and the sharing of JS code. 

Another quick question, does this code also work for intranet browser?

 

Regards,

Yuka


Hi ​@yuka.leong.external, it should. It would help to know exactly where in the Inspect panel you are seeing the emailID. 

Assuming it is in local storage within your domain application, the code above should work when you add it to a question within your survey. 

If it’s in the JavaScript variable or in the window, 

  • Where to look: Console → type: EmailID or window.EmailID or check the Elements tab and search for the value

  • This code should work:

    Qualtrics.SurveyEngine.addOnload(function() { var email = window.user?.EmailID; if (email) { Qualtrics.SurveyEngine.setEmbeddedData("EmailID", email); } });


Leave a Reply