====== bleeper - Censor offensive words in text responses ======
The **bleeper** function censors offensive words in text responses. It flags responses with offensive words and replaces offensive words with alternative characters (e.g., #). The bleeper function can be used on any type of question that contains text responses. Access to a database of offensive words is included, but use of alternative sources is supported.
This function is available for a reasonable fee. Contact **[[https://community.qualtrics.com/inbox/conversation?with=373|TomG]]** on the Qualtrics Community to learn more.
===== Set-up Instructions =====
==== Survey Header ====
Add the bleeper function to the survey header to make it available to any question in the survey.   Go to Look & Feel -> General -> Header edit -> {{::icon_source.jpg?20|}} and paste the provided bleeper function JS:
Alternatively, paste the bleeper function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
==== Question JavaScript ====
Add JS to call the bleeper function to apply it to a question as follows:
Qualtrics.SurveyEngine.addOnload(function() {
	bleeper(this);
});
To override the default options, specify the desired **[[bleeper#options|options]]** in the second function argument as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() {
	bleeper(this,{bleepFlagVar:"Q1bleepFlag"});
});
===== Options =====
==== addWords ====
**addWords** is an array of offensive words to be censored in addition to the offensive words returned by jsonSource. 
Default: []
==== bleepFlagVar ====
**bleepFlagVar** is the name of an embedded data field that captures whether any words were censored by setting its value to 1. To save **bleepFlagVar** in Qualtrics response data, define it as an embedded data field in the survey flow.
Default: %%"bleepFlag"%%
==== jsonSource ====
**jsonSource** is the url of a webservice that returns a json string containing an array of offensive words. It can be used in place of the default database that contains approximately 470 offensive words in English.
if **jsonSource** is set to empty %%("")%% only **[[bleeper#addWords|addWords]]** will be used. 
==== removeWords ====
**removeWords** is an array of words that should NOT be censored even though they are included in jsonSource. 
Default: %%[]%%
==== replace ====
**replace** is a boolean the specifies whether censored words should be replaced.  If false, offensive words are not replaced but the **[[bleeper#bleepFlagVar|bleepFlag]]** is set if any offensive words are found. 
Default: true
==== replStr ====
**replStr** a string used to replace characters in offensive words. 
Default: %%"#"%%
==== selector ====
**selector** a css selector specifying the text input fields within the question that the bleeper function should be applied to.  **selector** can be used to enable bleeper on any type of question containing text responses or specific text responses within a question. 
Default: %%".InputText"%%
====== Qualtrics Wiki ======
[[start|Qualtrics Wiki]]