Skip to content

Commit 72bd971

Browse files
committed
added some more logic for splittests
1 parent 329540a commit 72bd971

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

dist/breinify-api.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15721,7 +15721,39 @@ dependencyScope.jQuery = $;;
1572115721
var _privates = {
1572215722
ready: false,
1572315723

15724+
storeSplitTest: function(data) {
15725+
var additionalData;
15726+
if (!$.isPlainObject(data)) {
15727+
return;
15728+
} else if ($.isArray(data.results)) {
15729+
additionalData = [];
15730+
for (var i = 0; i < data.results.length; i++) {
15731+
var result = data.results[i];
15732+
if ($.isPlainObject(result.additionalData)) {
15733+
additionalData.push(result.additionalData);
15734+
}
15735+
}
15736+
} else if ($.isPlainObject(data.additionalData)) {
15737+
additionalData = [ data.additionalData ];
15738+
} else {
15739+
return;
15740+
}
15741+
15742+
// iterate over the additionalData
15743+
for (var k = 0; k < additionalData.length; k++) {
15744+
// console.log(additionalData);
15745+
}
15746+
},
15747+
1572415748
handleRecommendationResponse: function(data, errorText, callback) {
15749+
15750+
// we check for split-tests and store the results in the localStorage
15751+
try {
15752+
this.storeSplitTest(data);
15753+
} catch (e) {
15754+
// ignore the exception, we still want to handle the response
15755+
}
15756+
1572515757
callback(data, errorText);
1572615758
},
1572715759

dist/breinify-api.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Breinify.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,39 @@
121121
var _privates = {
122122
ready: false,
123123

124+
storeSplitTest: function(data) {
125+
var additionalData;
126+
if (!$.isPlainObject(data)) {
127+
return;
128+
} else if ($.isArray(data.results)) {
129+
additionalData = [];
130+
for (var i = 0; i < data.results.length; i++) {
131+
var result = data.results[i];
132+
if ($.isPlainObject(result.additionalData)) {
133+
additionalData.push(result.additionalData);
134+
}
135+
}
136+
} else if ($.isPlainObject(data.additionalData)) {
137+
additionalData = [ data.additionalData ];
138+
} else {
139+
return;
140+
}
141+
142+
// iterate over the additionalData
143+
for (var k = 0; k < additionalData.length; k++) {
144+
// console.log(additionalData);
145+
}
146+
},
147+
124148
handleRecommendationResponse: function(data, errorText, callback) {
149+
150+
// we check for split-tests and store the results in the localStorage
151+
try {
152+
this.storeSplitTest(data);
153+
} catch (e) {
154+
// ignore the exception, we still want to handle the response
155+
}
156+
125157
callback(data, errorText);
126158
},
127159

0 commit comments

Comments
 (0)