-
-
Save lennardtastic/dcab1cfcec2f911836a5f8b34e649190 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
/** | |
* 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