Store contact information using JS? | XM Community
Question

Store contact information using JS?

  • 9 December 2019
  • 3 replies
  • 24 views

Userlevel 2
Badge +3
Hi everyone,
We are trying to use the Website Feedback tool within our product and our developers are trying to understand how Qualtrics can capture this information as embedded data. I am not a developer, but they asked me for examples of ways to use JS to store the information so that Qualtrics can pick up the values using the embedded data feature. Does anyone have an example of how one might store a person's name or email in an JS expression?

Thanks for your help.
-Mike

3 replies

Userlevel 4
Badge +4
Hi Mike,

There is a number of ways to go about doing that. I will lay out the simplest version of it and you can make take it up from there.

There are two main steps: 1) Pick up contact list values via embedded data fields; 2) Pick up values from embedded data fields via Piped Text in JS.

Step 1)
Let's say you have 3 variables in your contact list:

foo = x
bar = y
baz = z

Maybe you want all of them in your survey, maybe not, regardless: once you send out the email invites to your contact list you can pick up the values of the three variables via embedded data fields. Just add the variable names you need at the top of your survey and leave them blank so that the values are set from the URL.

Step 2)
Once the embedded data field has the needed value, you can use the following code in JS:
`var yourVarName = "${e://Field/foo}"`
As you might notice, in the quotations mark after the equal sign you can put any Piped Text you want.

For your specific case you might also consider using different piped text in the quotations - perhaps recipient first name (${m://FirstName}) but any Piped Text can work.

Relevant links:
https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/embedded-data/
https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/piped-text-overview/
Userlevel 2
Badge +3
@npetrov937 This is great thank you. Would any of this be possible if we aren't sending an email? We are trying to use the website feedback tool (site intercept) so there isn't an email being sent. We are trying to capture the information that exists in our product. Would the same method work by setting up a variable? Is there anything unique about the variable doing it this way?

This is what I have set up. I was told by the developer that he set up a variable called qualtrics.AccountId, so I assumed I could capture this value from JS?
!

Am I doing this incorrectly?

Thanks,
Mike
Userlevel 4
Badge +4
Hi @MikeB !

I am not precisely sure where you get the popup, to be honest.

But you can definitely capture information from an URL into your qualtrics survey.

Let's say the link to your survey looks something like this:

https://greenwichuniversity.eu.qualtrics.com/jfe/form/SV_5cNT3JXXXXXXXX?accountid=somevaluehere

Then you can add an embedded data variable at the very top of your qualtrics survey, call it "accountid" and leave it blank so that it says "Value will be set from Panel or URL" - then the value of your embedded data variable will be "somevaluehere".

Relevant link:
https://qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/passing-information-through-query-strings/

Hope that helps!

Nikolay

Leave a Reply