Skip to content

Commit

Permalink
Merge pull request #4645 from Countly/feature/feedback-custom
Browse files Browse the repository at this point in the history
[SER-919] changes to add custom object for feedback widgets send by sdk
  • Loading branch information
kanwarujjaval authored Oct 30, 2023
2 parents 46c9b54 + 7613674 commit da7f9b7
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,25 @@
dow: dow
};

try {
custom = JSON.parse(custom) ;
if (custom && custom.sg) {
custom = custom.sg;
}
else {
custom = {};
}
}
catch (error) {
custom = {};
}

for (var key in custom) {
if (!event.segmentation[key]) {
event.segmentation[key] = custom[key];
}
}

document.getElementById('countly-feedback-comment-textarea').value = "";
document.getElementById('countly-feedback-contact-me-email').value = "";

Expand Down Expand Up @@ -394,7 +413,7 @@
}
$.ajax({
"type": "GET",
"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),
"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,
"success": function(response) {
document.getElementsByClassName("success-modal-content")[0].style.display = "flex";
document.getElementsByClassName("modal-content")[0].style.display = "none";
Expand Down

0 comments on commit da7f9b7

Please sign in to comment.