• Hi,

    I am using Mailchimp and want to get the Mailchimp subscribe popup working on onclick
    (the standard popups can only be triggered immediately, after 5 seconds, after 20 seconds, after the visitors scrolls to the middle of the page, but not on a click.)

    To get this working a litte workaround is necessary, which is described here.

    It is necessary to add this script to the footer.php:

    <script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
    <script>
    function showMailingPopUp() {
      require(
        ["mojo/signup-forms/Loader"],
        function(L) {
          L.start({"baseUrl":"mc.us16.list-manage.com","uuid":"YOUR_UUID","lid":"YOUR_LID"})
        }
      );
     
      document.cookie = 'MCPopupClosed=;path=/;expires=Thu, 01 Jan 1970 00:00:00 UTC;';
      document.cookie = 'MCPopupSubscribed=;path=/;expires=Thu, 01 Jan 1970 00:00:00 UTC;';
    }
         
    document.getElementById("open-popup").onclick = function() {showMailingPopUp()};
    </script>

    The workaround works for me as long as Autoptimize is deactivated.

    Is there a way (e.g. a specific setting) to get this workaround working together with Autoptimize?

    Currently Autoptimize is deactivated and here is the current page I am working on.

    • This topic was modified 7 years, 6 months ago by catchbudapest.

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘script in footer.php’ is closed to new replies.