Skip to content

Instantly share code, notes, and snippets.

@vwo-kb
Last active April 10, 2020 09:54
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 vwo-kb/69ee27a98fc001cef9043b107d5d1733 to your computer and use it in GitHub Desktop.
Save vwo-kb/69ee27a98fc001cef9043b107d5d1733 to your computer and use it in GitHub Desktop.
JS variable for the Clearbit-VWO integration
(function() {
if (!window.ClearBitAdded) {
window.ClearBitAdded = true;
var script = document.createElement('script');
script.src = "https://reveal.clearbit.com/v1/companies/reveal?authorization=paste_your_clearbit_key_here&variable=reveal_organization";
var event = new CustomEvent("ClearBitAdded", {
"detail": "ClearBitAdded"
});
script.onerror = function() {
console.log('VWO: Error Ocuured while fetching the clearbit data');
document.dispatchEvent(event);
};
script.onload = function() {
document.dispatchEvent(event);
};
document.getElementsByTagName('head')[0].appendChild(script);
return true;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment