Basically I am trying to use a profitWell script in my angular application this is the script
<script id="profitwell-js" data-pw-auth="XXX">
(function(i,s,o,g,r,a,m){i[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)};
a=s.createElement(g);m=s.getElementsByTagName(g)[0];a.async=1;a.src=r+'?auth='+
s.getElementById(o+'-js').getAttribute('data-pw-auth');m.parentNode.insertBefore(a,m);
})(window,document,'profitwell','script','https://public.profitwell.com/js/profitwell.js');
profitwell('start', { 'user_email': 'USER_EMAIL_HERE' });
</script>
now I have put this script in the <head> of my index.html and removed the profitWell('start') from it because I need to wait until a user authenticates before I can send in the emailAddress
so my index.html looks like this
<head>
<!-- ... -->
<script id="profitwell-js" data-pw-auth="XXX">
(function(i,s,o,g,r,a,m){i[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)};
a=s.createElement(g);m=s.getElementsByTagName(g)[0];a.async=1;a.src=r+'?auth='+
s.getElementById(o+'-js').getAttribute('data-pw-auth');m.parentNode.insertBefore(a,m);
})(window,document,'profitwell','script','https://public.profitwell.com/js/profitwell.js');
</script>
</head>
now in my authentication component I have done the following
// ...
declare var profitWell: any;
// ...
authenticate() {
// ...
profitWell('start', {'user_email': this.email});
}
now I can see in my network that the profitWell script is being called but when I call the profitWell method I get the following
profitWell is not defined
now it is to my understanding when I add declare var profitWell: any that well let me use the global profitWell but I can't seem to get it to work.
window.profitWellis not a function