A digital fingerprint is a unique identifier created by analyzing various characteristics of a digital device, browser, or file, for the purposes of identification, tracking, or authentication. Digital fingerprinting can be useful for tracking duplicate responses from survey participants in cases where you suspect a high likelihood of poor quality or fraudulent responses, particularly if incentives are involved.
The script in this workflow uses FingerprintJS technology and a cookie to record survey participants' digital fingerprints. It works by leveraging participants' browser data—that is, it will detect and record two responses coming from the same browser as belonging to the same survey participant.
Important:
- This script uses a cookie. Consult your organization's cookie policy before using it.
- While useful, digital fingerprinting will not stop sophisticated bad actors from taking advantage of incentivized activities. As a best practice, we recommend not combining public recruitments with advertised incentives.
Detailed Steps
- On the first page of your survey, add a Text and Image element as a welcome message.
Important: The script needs some time to load in order to work correctly, so this welcome message needs to be long enough to take someone at least 5 seconds to read. If it's too short and someone clicks Next quickly, the script will not work. - Under the Text and Image element, add an Embedded Content element.
- Under the Embedded Content element, add a Short Answer question named fp.
- Under the fp question, add another Short Answer question named cookieExists.
At this point, your Table of Contents should look like this: - For both the fp and cookieExists questions:
- Ensure Hide question is cleared.
- Clear the Response required check boxes.
- In the Table of Contents, click the Embedded Content element to open it for editing.
- Copy and paste the script into the Embed content field.
- Replace the FPQId and cookieOE values in the script with the fp and cookieExists question IDs from your own survey.
- Export your survey.
- Extract the contents of the ZIP file and open the JSON file.
- Search for the fp question name value.
- Scroll up approximately 20-30 lines and look for a value named id.
- Copy and paste this value into the script to replace the placeholder FPQId value.
- Repeat steps c to e for the cookieExists question and the placeholder cookieOE value.
-
Optional: Add a test screen to ensure the digital fingerprint is being recorded correctly.
Note: Embedded Content elements do not work in survey preview, so testing this in survey preview will not work. Instead, get a test activity link.
- After your final question, on a new page, add a Text and Image element.
- Copy and paste the following text into the Instruction text field:
fp:
cookieExists: - Pipe the corresponding questions into the instruction text after each colon.
- Test your survey through a test activity link.
When you are using the same browser to respond multiple times and you arrive at the test screen, you should see a unique identifier after fp and a 1 after cookieExists.
- When you view your results in reporting, look for the following indicators that a response is a duplicate:
- There are duplicate values in the fp column.
- There is a 1 in the cookieExists column.
Tip: To exclude the duplicate responses, in modern reporting, add a filter condition that includes data if This Survey cookieExists Has no value.
Script
<script src="https://static.visioncritical.net/prog/ext_libs/jquery/jquery-3.1.0.min.js" type="text/javascript"></script>
<script>
// How do I capture a survey participant's digital fingerprint? (Modern Surveys) // To ensure your script works as expected, always copy the original script from the Script Library found in the Alida Help Center. Failure to use the latest script from the script library may cause unexpected results.
// Change these 2 placeholder question IDs and replace them with the unique question IDs from your own survey.
const FPQId = '7e03decc-dded-414a-8021-37e69e5fcce3'; const cookieOE = '9806b53a-e1bf-4536-93bf-4fa5a86922c7';
// Don't modify anything below
setTimeout(function(){ $( document ).ready(function() { function hideQuestion(questionId) { var question = document.getElementById(questionId); question.style.display = 'none';
}
function setValue(questionId, value) { console.log("set value Qid:"+questionId); window['saveDataPoint' + questionId](value); console.log("val:"+value);
}
//Add cookie that expires in 7 days function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
let expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
console.log("setCookie"+cname);
}
function getCookie(cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for(let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
console.log("getCookie"+cname); return c.substring(name.length, c.length);
}
}
return "";
}
//Expires in 7 days
function checkCookie() {
let user = getCookie("fp-"+visitorId);
if (user != "") {
setValue(cookieOE, "1"); console.log("checkCookie existing: "+user); } else { console.log("checkCookie new: "+visitorId); setCookie("fp-"+visitorId, visitorId, 7); } }
// Initialize the agent at application startup. // If you're using an ad blocker or Brave/Firefox, this import will not work. // Please use the NPM package instead: https://t.ly/ORyXk
var visitorId = ""; const fpPromise = import('https://openfpcdn.io/fingerprintjs/v4') .then(FingerprintJS => FingerprintJS.load())
// Get the visitor identifier when you need it.
fpPromise .then(fp => fp.get()) .then(result => {
// This is the visitor identifier:
visitorId = result.visitorId
setValue(FPQId, visitorId); console.log("visitorid: "+visitorId) checkCookie(); }) })
}, 1000);
</script>
<style> .dyUISd, .kEAzXF { display: none !important; } </style>
Comments
0 comments
Please sign in to leave a comment.