Last active
April 10, 2020 09:54
-
-
Save vwo-kb/69ee27a98fc001cef9043b107d5d1733 to your computer and use it in GitHub Desktop.
JS variable for the Clearbit-VWO integration
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
(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