====== gaborGranger - Use the Gabor Granger method to determine the price of a new product or service ======
The **gaborGranger** function implements the [[https://en.wikipedia.org/wiki/Gabor%E2%80%93Granger_method|Gabor Granger]] method in Qualtrics. Features include:
* Supports any number of prices
* Only requires one question in a loop & merge block
* Simple and flexible set-up
* Supports multiple Gabor Granger exercises in a survey
* Optionally save the display order of prices
Here is a demo:\\
{{ :gaborGranger.mp4?600 |gaborGranger Demo}}
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 =====
==== Add Gabor Granger Block to Survey ====
The gaborGranger function uses Qualtrics Loop & Merge functionality. There will be one gaborGranger question within its own block. Set the number of loops to the number of prices.
==== Add Multiple Choice Question to gaborGranger Block ====
The MCQ is typically a five point scale. Recodes must go from least likely (e.g., 1) to most likely (e.g., 5). Include a span in the question text where the price will be displayed:
How likely are you to buy X at a price of $?
Add display logic to only display the question if the embedded data field **[[gaborgranger#ggFound|ggFound]]** is not equal to 1.
====Add gaborGranger Function====
Paste the gaborGranger function JS into the question's JS outside the existing Qualtrics functions.
To make the function available to multiple Gabor Granger questions in the survey, copy the function to the Survey Header inside a script tag. Go to Look & Feel → General → Header edit → and paste the provided gaborGranger function JS:
==== JavaScript Function Call ====
Call the gaborGranger function from the question's addOnload function using the default settings as follows:
Qualtrics.SurveyEngine.addOnload(function() {
gaborGranger(this);
});
To override the default options, specify the desired options in the second function argument as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() {
gaborGranger(this,{delim:"|"});
});
See **[[gaborGranger#Options|Options]]** for details.
==== Add Embedded Data Fields to Survey Flow ====
The gaborGranger function requires three embedded data fields: a delimited list of prices (**[[gaborgranger#ggPrices|ggPrices]]**), a found flag (**[[gaborgranger#ggFound|ggFound]]**), and the Gabor Granger variable (**[[gaborgranger#ggPrice|ggPrice]]**). Prior to the gaborGranger block, initialize the embedded data fields. For example:
{{ :gg_surveyflow.png?800 |gaborGranger Survey Flow}}
An optional fourth embedded data field (**[[gaborgranger#ggDisplayOrder|ggDisplayOrder]]**) can be added.
===== Options =====
==== delim ====
**delim** is the string used to delimit prices in the ggPrices price list.
Default: %%","%%
==== displayPriceClass ====
**displayPriceClass** is the name of a html class used to identify the html span that contains the price in the gaborGranger question text.
Default: %%"price"%%
==== ggFound ====
**ggFound** is the name of the embedded data field flag that is set to 1 when the final Gabor Granger price has been found.
Default: %%"ggFound"%%
==== ggDisplayOrder ====
**ggDisplayOrder** is the name of the embedded data field that contains the displayed order of prices when **[[gaborgranger#saveDisplayOrder|saveDisplayOrder]]** is true.
Default: %%"ggDisplayOrder"%%
==== ggPrice ====
**ggPrice** is the name of the embedded data field that contains the Gabor Granger variable (aka price)
Default: %%"ggPrice"%%
==== ggPrices ====
**ggPrices** is the name of the embedded data field that contains the delimited Gabor Granger price list.
Default: "ggPrices"
==== saveDisplayOrder ====
**saveDisplayOrder** is a boolean that specifies if the display order of prices should be saved to **[[gaborgranger#ggDisplayOrder|ggDisplayOrder]]**.
Default: false
==== top2Recode ====
**top2Recode** is the recode value of the first of the top 2 choices.
Default: 4
====== Qualtrics Wiki ======
[[start|Qualtrics Wiki]]