How do you access localStorage values as embedded data? They always return null. | XM Community
Skip to main content

I have a Website/App Insights with a Feedback button Intercept/Creative. Under Embedded Data I have Use Value from Javascript  with the following value:

window.localStorage.getItem("1")

This line works when I run it in the browser console.

However, this is reported as null in the Results of the Survey. Is this a scope issue, or is there another way to get Local Storage as Embedded Data?

Embedded data is not local storage, you’ll need to take data from local storage and save them as embedded data. 

Please refer to this for storing ED: https://api.qualtrics.com/82bd4d5c331f1-qualtrics-java-script-question-api-class 


Thanks Ahmed, but I already know they are not the same and I have already tried the technique that you are suggesting. Local Storage is returned as null from any component within the Qualtrics. I am thinking this is probably a scope problem on account of the iframe.


Okay. If you are trying to access local storage set by some other document then it isn’t possible. Local storage is scoped to that specific page.

Details: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage


Thanks for the help! In my original post I mentioned that this is a Website/App Insights Feedback button intercept. This component is inherently only used in other sites.


I had to use window.postMessage to communicate between the site and the iframe (Qualtrics component) to pass the local storage variable.

https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage


Leave a Reply