Skip to content

Commit 2cfbb92

Browse files
Fix description and some other stuff
1 parent 99ff9b3 commit 2cfbb92

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/modules/tracker.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,8 +2449,8 @@ class Tracker {
24492449
* {
24502450
* quizId: 'coffee-quiz',
24512451
* matchedFacet: 'coffee_facet',
2452+
* matchedQuery: 'nescafe',
24522453
* searchQuery: 'coff',
2453-
* url: 'www.example.com',
24542454
* },
24552455
* );
24562456
*/
@@ -2538,14 +2538,14 @@ class Tracker {
25382538
* @param {object} [networkParameters] - Parameters relevant to the network request
25392539
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
25402540
* @returns {(true|Error)}
2541-
* @description User typed a search query and it caused a quiz trigger to pop up
2541+
* @description Triggered whenever user clicks on a quiz trigger popup
25422542
* @example
25432543
* constructorio.tracker.trackQuizTriggerClick(
25442544
* {
25452545
* quizId: 'coffee-quiz',
25462546
* matchedFacet: 'coffee_facet',
2547+
* matchedQuery: 'nescafe',
25472548
* searchQuery: 'coff',
2548-
* url: 'www.example.com',
25492549
* },
25502550
* );
25512551
*/
@@ -2575,10 +2575,18 @@ class Tracker {
25752575
return new Error('"searchQuery" is a required parameter of type string');
25762576
}
25772577

2578-
if (typeof matchedFacet !== 'string' || typeof matchedQuery !== 'string') {
2578+
if (typeof matchedFacet !== 'string' && typeof matchedQuery !== 'string') {
25792579
return new Error('"Either matchedFacet or matchedQuery" is a required parameter of type string');
25802580
}
25812581

2582+
if (matchedFacet && typeof matchedFacet !== 'string') {
2583+
return new Error('If matchedFacet is present, it has to be a string');
2584+
}
2585+
2586+
if (matchedQuery && typeof matchedQuery !== 'string') {
2587+
return new Error('If matchedQuery is present, it has to be a string');
2588+
}
2589+
25822590
bodyParams.quiz_id = quizId;
25832591
bodyParams.matched_facet = matchedFacet;
25842592
bodyParams.matched_query = matchedQuery;

0 commit comments

Comments
 (0)