Honeypot code for bots, but explained? | XM Community
Skip to main content

Hello, I'm new here, so forgive me if I'm asking a completely obvious question.
I have a survey that I'd like to try and make as secure as possible. In addition to all the, for lack of a better word, clickable options in the survey platform - I'm also intrigued by the idea of adding a honeypot field for bots.
I have seen the code in another thread. https://community.qualtrics.com/XMcommunity/discussion/6152/hidden-question-traps-for-bots
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId).prev('.Separator').hide();
jQuery("#"+this.questionId).hide();
});
However, I have two problems.
First, despite lots of searching I can't find anywhere that explains what this code is doing (and again forgive me for wasting anyone's time as I'm very unfamiliar with coding, don't mind learning, but just don't understand). I know that it's providing a hidden field, but I don't know what that hidden field is doing or (and this is the second problem) how to interpret it once I have collected my data. So even a nudge of "hey start here with learning some programming language" would be much appreciated.
I know that with the other options (e.g., captcha, logic questions, etc). This may seem unnecessary, but now that I'm here I'd kind of like to understand it so I could either use it here or potentially in the future.

// This function is executed when the survey loads
Qualtrics.SurveyEngine.addOnload(function() {
// Select the previous HTML element with class 'Separator' and hide it
jQuery("#"+this.questionId).prev('.Separator').hide();
// Hide the current HTML element with the ID equal to the current question ID
jQuery("#"+this.questionId).hide();
});

For normal respondents, they wont see it but bots will be able to give response to this question.
And thus in survey flow you can , put a branch condition that who ever answer this condition who will get terminated.
And thus in this way you can filter out the bots from normal respondents during live survey only.
You need to add to some extra codes from this link(shared by you ) also if not yet done:
https://community.qualtrics.com/XMcommunity/discussion/6152/hidden-question-traps-for-bots


This is super helpful.
Im still unclear where I add extra code. Is it where the ‘this.questionId’ information is?
so instead of looking like this
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId).prev('.Separator').hide();
jQuery("#"+this.questionId).hide();
});
it would look like
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+place.a.number.here.questionId).prev('.Separator').hide();
jQuery("#"+place.a.number.here.questionId).hide();
});
That seems like the easiest sort of question (just a hidden field that asks them to place a number there. Invisible to human participants, but completed by bots.


Notably, I have now received word that my institution’s license does not include “bot detection” on the survey options. So these honeypot fields have become more of a necessity than an optional extra layer, as upgrading that license isn’t something that’s feasible (given that it would likely take months of working through the systems in place at my institution, and they might not approve such an upgrade anyway).


@ZacJx Did you have any luck implementing this? After speaking with the RelevantID team we have some concern with simply relying on these “bot detection” methods and would like to implement and additional check. Since this should be hidden from standard users views, it would allow us to confirm accuracy of not only bots, but possibly simplier script use.


@kgittner Unfortunately, no I didn’t have any success in implementing the honeypot questions. I think you’re right in approaching it as a both/and situation rather than an either/or though.

I never got a good grasp on how to upload/implement the code into my survey. So I just went with a real cautious approach to data collection, which was challenging; it took nearly a year to collect all of the necessary data and I still encountered bots.

Happy to chat more about this if you’re interested.


Leave a Reply