carlsednaoui / ouibounce

Increase your landing page conversion rates.
MIT License
2.31k stars 373 forks source link

Unable to access ouibounce function in a static .js file #148

Open chakanish opened 3 years ago

chakanish commented 3 years ago

Hi,

I am trying to use this library in a snippet code that is hosted as a static .js file in a cdn share.

this script is imported by several other 3rd party websites.

I am using the below code in the static .js file.

// ouibounce script load var ouibounceScript = document.createElement("script"); ouibounceScript.src = "https://cdnjs.cloudflare.com/ajax/libs/ouibounce/0.0.12/ouibounce.js"; document.head.appendChild(ouibounceScript);

var modal = ouibounce(document.getElementById("widget-view")); modal.fire();

However this is throwing me an error stating ouibounce is not defined

Can you please help?

Thanks.