Skip to content

Instantly share code, notes, and snippets.

@lennardtastic
Created July 23, 2018 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lennardtastic/dcab1cfcec2f911836a5f8b34e649190 to your computer and use it in GitHub Desktop.
Save lennardtastic/dcab1cfcec2f911836a5f8b34e649190 to your computer and use it in GitHub Desktop.
/**
* Send Decibel session ID to Usabilla;
* If you already pushed custom variables to Usabilla, include the variable there or other custom variables will get overwritten
*/
window.usabilla_live('data', {
custom: {
'Decibel Insight Session ID': decibelInsight.getSessionId() || ''
}
});
/**
* Send integration data to Decibel Insight
* If you already set a 'setEventCallback' for your Usabilla implementation, make sure to check that since the previous 'setEventCallback' will get overwritten
*/
window.usabilla_live('setEventCallback', function(
category,
action,
label,
value
) {
function onDecibelReady() {
if (action === 'Feedback:Open') {
decibelInsight('sendIntegrationData', 'Usabilla', {
f: 'Open'
});
}
if (action === 'Feedback:Success') {
decibelInsight('sendIntegrationData', 'Usabilla', {
f: 'Success',
s: value
});
}
if (action === 'Campaign:Open') {
decibelInsight('sendIntegrationData', 'Usabilla', {
c: 'Open',
i: label
});
}
if (action === 'Campaign:Success') {
decibelInsight('sendIntegrationData', 'Usabilla', {
c: 'Success',
i: label
});
}
}
if (window.hasOwnProperty('decibelInsight')) {
decibelInsight('ready', onDecibelReady);
} else {
window['_da_ready'] = onDecibelReady;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment