Hi folks, I want to extract the number highlighted in yellow from below url as an embedded data in data and analysis section of Qualtrics for a website/app insights project. I have pasted the below code in the intercept under “add Javascript” option. However, still the code for some reason does not seem to work. I have also set the embedded data in Qualtrics for the field “extractedNumber”
https://www.merkle.com/en/careers/jobs.html/rs/743999952894453.html
// Get the current URL
const currentURL = window.location.href;
// Split the URL using '/' as a separator
const urlParts = currentURL.split('/');
// Find the part of the URL that contains the number
let extractedNumber = null;
urlParts.forEach(part => {
if (!isNaN(part) && part.length > 12) {
// Assuming the number has a length greater than 12
extractedNumber = part;
}
});
// Set the extracted number as Qualtrics embedded data
Qualtrics.SurveyEngine.setEmbeddedData('extractedNumber', extractedNumber);
Can someone help?