README.md

qualtricks

Packaged convenience functions for Qualtrics Site Intercept (Website/App Feedback) API and Survey API functions not in ropensci/qualtRics, e.g.,

listUsers getUserAPIToken createUserAPIToken listSurveys (allowing parameters)

WIP

Tips

Brand Admin utilities

  1. List Qualtrics User Type Permissions from Admin Panel
rules = document.querySelectorAll("td[class*=Col_PermissionName]")

table = [];

for(i = 0; i < rules.length; i++) {
    tabName = rules[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentElement.parentElement.parentElement.parentElement.id; // eg "GeneralSection"
    tabSection = rules[i].id.replace("PermissionLabel-", ""); // eg "Project Permissions"
    itemName = rules[i].innerText.replace(/\r?\n|\r/g, "").replace(/\s\s+/g, ""); //eg "Brand Experience"

if(tabSection.match("Restriction") == null) {
    itemEnabled = rules[i].parentNode.querySelectorAll("a")[0].className + rules[i].parentNode.querySelectorAll("a")[0].title;
    itemEnabled = itemEnabled.replace("Checkbox EnabledUnchecked", "").replace("Enables this permission", "").replace("Checkbox EnabledUnused", "");
    itemDisabled = rules[i].parentNode.querySelectorAll("a")[1].className + rules[i].parentNode.querySelectorAll("a")[1].title;
    itemDisabled = itemDisabled.replace("Checkbox DisabledUnchecked", "").replace("Disables this permission", "").replace("Checkbox DisabledUnused", "");

} else {
    if(rules[i].parentNode.querySelector("span.Hidden") != null) {
        itemEnabled = rules[i].parentNode.querySelector("input") .value;
    } else {
        itemEnabled = "unlimited";
    }
    itemDisabled = null;
}
    table[i] = tabName + "|" + tabSection + "|" + itemName + "|" + itemEnabled + "|" + itemDisabled;

}

table.join("\n"); // paste into excel or something

Version control intercepts as code (Chrome)

  1. Go to any intercept project's editor (doesn't matter which, you'll get all projects within the zone)
  2. Open browser developer tools
  3. Reload page
  4. In developer tools: Network tab, filter results to GetZoneIntercept → Preview
  5. Right click → Store object as global variable (the raw response is also available under Response but is slower/buggier to copy)
  6. In console, run copy(temp1)
  7. Paste into a text editor and save file. Name file after intercept ID, e.g., SI_abc123.json.
  8. Optionally: print the editor page as a PDF (landscape), e.g., SI_abc123.pdf

getZoneIntercept screenshot

You can also push this payload via fetch in the console

  1. From the intercept editor UI, save an arbitrary change and capture the Network Request "SaveIntercept" as a fetch request
  2. Paste copied request in text editor, it'll look something like this: fetch("https://hbp.az1.qualtrics.com/DX/InterceptsSection/EditIntercept/Ajax/SaveIntercept", { "headers": { "accept": "text/javascript, text/html, application/xml, text/xml, */*", "accept-language": "en-US,en;q=0.9,es;q=0.8", "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\"", "sec-ch-ua-mobile": "?0", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-origin", "x-prototype-version": "1.7.3", "x-requested-with": "XMLHttpRequest", "x-xsrf-token": "XSRF_abc123" }, "referrer": "https://abc.az1.qualtrics.com/DX/InterceptsSection/EditIntercept?ContextIntercept=SI_abc123&ContextZone=ZN_abc123", "referrerPolicy": "strict-origin-when-cross-origin", "body": "Definition=%7B%22Status%22%3A%22Active%22%2C%22Edited%22%3Atrue%2C%22ZoneID%22%3A%abc123..." "method": "POST", "mode": "cors", "credentials": "include" });
  3. Replace everything after "Definition=" in the body value with the relevant intercept payload from above and run in the browser console.

saveIntercept screenshot



derring-do/qualtricks documentation built on April 25, 2021, 12:38 a.m.