Skip to content

Commit da7f9b7

Browse files
authoredOct 30, 2023
Merge pull request #4645 from Countly/feature/feedback-custom
[SER-919] changes to add custom object for feedback widgets send by sdk
2 parents 46c9b54 + 7613674 commit da7f9b7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed
 

‎plugins/star-rating/frontend/public/templates/feedback-popup.html

+20-1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,25 @@
299299
dow: dow
300300
};
301301

302+
try {
303+
custom = JSON.parse(custom) ;
304+
if (custom && custom.sg) {
305+
custom = custom.sg;
306+
}
307+
else {
308+
custom = {};
309+
}
310+
}
311+
catch (error) {
312+
custom = {};
313+
}
314+
315+
for (var key in custom) {
316+
if (!event.segmentation[key]) {
317+
event.segmentation[key] = custom[key];
318+
}
319+
}
320+
302321
document.getElementById('countly-feedback-comment-textarea').value = "";
303322
document.getElementById('countly-feedback-contact-me-email').value = "";
304323

@@ -394,7 +413,7 @@
394413
}
395414
$.ajax({
396415
"type": "GET",
397-
"url": url + '/i/feedback/input?events=' + encodeURIComponent(JSON.stringify([eventObject])) + '&app_key=' + app_key + '&device_id=' + device_id + '&sdk_name=' + sdk_name + (sdk_version ? '&sdk_version=' + sdk_version : '') + '&timestamp=' + Date.now() + '&hour=' + h + '&dow=' + dow + '&app_version=' + app_version + '&custom=' + encodeURIComponent(custom),
416+
"url": url + '/i/feedback/input?events=' + encodeURIComponent(JSON.stringify([eventObject])) + '&app_key=' + app_key + '&device_id=' + device_id + '&sdk_name=' + sdk_name + (sdk_version ? '&sdk_version=' + sdk_version : '') + '&timestamp=' + Date.now() + '&hour=' + h + '&dow=' + dow + '&app_version=' + app_version,
398417
"success": function(response) {
399418
document.getElementsByClassName("success-modal-content")[0].style.display = "flex";
400419
document.getElementsByClassName("modal-content")[0].style.display = "none";

0 commit comments

Comments
 (0)
Please sign in to comment.