carlsednaoui / ouibounce

Increase your landing page conversion rates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to access ouibounce function in a static .js file

chakanish opened this issue · comments

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.