Skip to content

Instantly share code, notes, and snippets.

@vwo-kb
vwo-kb / callingActivateManually
Created September 9, 2019 08:32
force the change by manually calling activate function in setinterval (Use this with precaution as it may cause the website to lag).
VWO.push(['activate', < should_keep_interval_running > ]);
@vwo-kb
vwo-kb / updateCustomURL
Created September 9, 2019 10:28
If actual URL is changing and you want to change the custom URL, use the following code snippet to update the custom URL
(function() {
window.VWO.push(['onEventReceive', 'uC', function() {
// Add your custom url here
window._vis_opt_url = ";
}]);
})();
@vwo-kb
vwo-kb / updateCustomURL
Last active February 19, 2020 10:21
If actual URL is changing and you want to change the custom URL, use the following code snippet to update the custom URL
(function() {
window.VWO.push(['onEventReceive', 'uC', function() {
// Add your custom url here
window._vis_opt_url = 'http://myVisOptURL.com/vis-opt';
}]);
})();
@vwo-kb
vwo-kb / vwoClearbitIntegration.js
Last active April 10, 2020 09:54
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');
@vwo-kb
vwo-kb / nonGTM.js
Created October 22, 2019 08:16
How to Integrate VWO with UA through a non-GTM Tag Manager
ga.getAll().forEach(function(e) {
if (e.get('trackingId') == 'UA-9679904-1') {
console.log(window.finalprefix = e.get('name'));
};
});
//Replace NEW_VIRTUAL_PAGE_URL with your customized URL)
window.VWO = window.VWO || [];
window.VWO.push(['activate', {
virtualPageUrl: 'NEW_VIRTUAL_PAGE_URL'
}]);
<script type = 'text/javascript' >
_vis_opt_cookieDays = 1,
</script>
<script type = 'text/javascript' >
settings_tolerance = 2000,
library_tolerance = 2500,
</script>
<script type = 'text/javascript' >
hide_element = '',
</script>
<script type='text/javascript'>
var _vis_opt_domain = 'yourdomain.com',
</script>