Search code examples
javascriptphpcachingmailchimp

Need assistance with cache and Mail Chimp signup form on website


I have a custom mailchimp popup signup form that I created. This works initially when you visit the page, but it does not continue to popup every time you revisit the page. You must clear the browser cache for it to show up every time. Is there any work around for this?

Here is the script im using:

<script>require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us7.list-manage.com","uuid":"d6762f1a98ccc78b15fa5d048","lid":"c885125250"}) })</script>

I tried to add this to the meta data and it still doesnt work.

<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />

Im basically trying to find a way to clear the cache every time this page in particular is loaded so that the signup form shows.

Hope someone can help thanks!


Solution

  • There's no setting in MailChimp to make the popup continue to appear, but there is a workaround. The MailChimp form uses two cookies, MCPopupSubscribed and MCPopupClosed, to determine if the user has either subscribed or closed the form previously. If either cookie is set, the form won't appear. So just deleting those cookies will ensure it shows up.

    Since the question is tagged with both PHP and Javascript, I've included both as solutions. Just add either of these to the page you're using the popup on.

    PHP:

    setcookie('MCPopupSubscribed', '', 1, '/');
    setcookie('MCPopupClosed', '', 1, '/');
    

    Javascript:

    document.cookie = "MCPopupSubscribed=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/";
    document.cookie = "MCPopupClosed=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/";