I would need the community's help to solve the following URL-related problem.
I need to report the data relating to the URL and the keywords entered in the site search in the dashboard, but the link for some keywords is broken and therefore incorrect when you go to click in the dashboard.
below is how I set up the data in the dashboard
in the Search LM column keywords entered by users that are not always linked
Many tanks in advance for your help, Genny
Page 1 / 1
@GBelardi Is the issue for the last 3 links which do not only contain “link” as placeholder in the “Search LM” column? I could imagine that the spaces in the links are an issue and that the full text can therefore not be identified as one link but a link and additional text.
Are those links actually correct? For the other links the search terms with multiple words are concatenated with “+”.
Best Chrisitian
Hi @chackbusch
no the issue is not for the last 3 links but also for the rest of the dataset, I don't know if the problem is with how the URL is captured in the survey.
I don't know what causes the link break sometimes.
Maybe it needs to be set differently in the survey flow.
Thanks for your help
Genny
Hi @chackbusch ,
Perhaps I need to add Q_URL in the embedded data as suggested here
Could this re-arrange the link structure and then it would display correctly in the dashboard? What do you think?
@GBelardi You can try with Q_URL but this build-in field is the URL first used to access the survey. Have you embedded the survey on your website? The embedded data “Current Page URL” in this context provides the page the visitor is on when the Intercept appears on the website.
Maybe some other question - do you actually need the full link in your dashboard or are you only interested in the search terms contained?
Best Christian
Hi @chackbusch
Yes the survey it’s already embedded on the website.
As you said :The embedded data “Current Page URL” in this context provides the page the visitor is on when the Intercept appears on the website.
What I don't understand is why Current Page URL sometimes it manages to capture the search words and other times it doesn't.
I don't see any difference in how the search is performed.
And I would like to understand if there is a way to correct the data in Qualtrics outside of the embedded data.
Yes the request is to have the entire link.
Thanks again for your help :)
@GBelardi I actually do also not understand why the URLs are incorrect for some query strings. Spaces within the URL are invalid.
Spaces should be replaced by ‘%20’
In the query string part of the URL the ‘%20’ can also be replaced with ‘+’ to shorten it
As you see in your examples, the spaces in the URL were sometimes correctly replaced but other times they were not.
To fix this, you could add some additional embedded data FixedURL to your embedded data block:
I assigned some sample value to current page URL which is invalid. You do not need to assign anything as this is happening automatically.
Then you could add some JavaScript to the first question after the embedded data block.
Qualtrics.SurveyEngine.addOnReady(function() { // Get the value of the embedded data "Current Page URL" var currentPageURL = "${e://Field/Current Page URL}";
// Split the URL into base URL and query string var urlParts = currentPageURL.split('?'); var baseURL = urlPartsa0]; // The base URL before the query string var queryString = urlPartsS1] || ''; // The query string part
// Replace spaces with %20 in the base URL var fixedBaseURL = baseURL.replace(/ /g, '%20');
// Replace spaces with + in each key-value pair of the query string var fixedQueryString = queryString.split('&').map(function(param) { var keyValue = param.split('='); keyValue>1] = keyValuel1].replace(/ /g, '+'); return keyValue.join('='); }).join('&');
// Reconstruct the fixed URL var fixedURL = fixedBaseURL + (fixedQueryString ? '?' + fixedQueryString : '');
// Store the fixed URL in embedded data "FixedURL" Qualtrics.SurveyEngine.setEmbeddedData("FixedURL", fixedURL); });
The result should be that FixedURL contains the corrected URL.
In your dashboard you should be able to work with this.
Best Christian
Hi @chackbusch
It's a great solution! Thank you so much for your help. Have a nice day