Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The free version (below 2000 subscribers) of MailChimp subscription popup allows at most 5 seconds of delay before the pop up window executes. But i want to delay the popup to 45 seconds. Is there any way to make it happen? The Original code is written below.

JavaScript
<script type="text/javascript"src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) })</script>
</script>

What I have tried:

I used timeout() and $.getScript() function..but it's still not working for me. Maybe i have not implemented them correctly.

Improvised version of code.

JavaScript
<script type="text/javascript"src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">setTimeout( function () {
$.getScript(require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) }))}, 4500);</script>


It seems like i am still making some mistake..could you please point out my mistake..or probably re-paste the correct version of code.
Posted
Updated 18-Jul-16 4:14am
v2

1 solution

Firstly, the unit of timeout is milliseconds, so 45 seconds translate into 45000 milliseconds.
Secondly, since the script already provided 5 seconds delay, you need to delay it further for another 40 seconds (40000 milliseconds) to get a total of 45 seconds.
Finally, the code:
JavaScript
setTimeout(function(){
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) })
}, 40000)
 
Share this answer
 
v2
Comments
Member 12640879 18-Jul-16 10:26am    
I tried your solution solution..but still the popup window itself is not showing..Seems like i am still making some mistake. Could please go through the code once again.

<script type="text/javascript"src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">setTimeout(function(){
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) })
}, 40000)</script>
Peter Leow 18-Jul-16 10:52am    
see for yourself https://jsbin.com/zitekezotu/1/edit?html,output
Try on different browsers. Clear browser history if need be.
Member 12640879 18-Jul-16 13:27pm    
oh..yeah i had almost forgotten that the popup thing works for only new visitors..as it drops cookies on every visit in order to prevent it from coming again.
After deleting my cookies i got it.
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900