Created
January 17, 2023 21:08
-
-
Save LMG23/cac1338a1a0c58e022d9474e27a4a6ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.usabilla_live('setEventCallback', function(category, action, label, value, userData){ | |
function flat(source, target) { | |
Object.keys(source).forEach(function (k) { | |
if (source[k]!== null && typeof source[k] === 'object') { | |
flat(source[k], target); | |
return; | |
} | |
target[k] = source[k]; | |
}); | |
} | |
if(action === "Feedback:Success" || (action === "Campaign:Page Switch" && userData.end)) { | |
var userDataFlat = {}; | |
flat(userData, userDataFlat); | |
for(var i in userDataFlat) { | |
console.log(i +" => " + userDataFlat[i]); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment