<!-- This is the HTML element that, when clicked, will cause the popup to appear. --> | |
<button id="open-popup">Subscribe to our mailing list</button> |
<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> | |
function showMailingPopUp() { | |
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"YOUR_UUID_GOES_HERE","lid":"YOUR_LID_GOES_HERE"}) }) | |
document.cookie = "MCEvilPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; | |
}; | |
document.getElementById("open-popup").onclick = function() {showMailingPopUp()}; | |
</script> |
This comment has been minimized.
This comment has been minimized.
Hello Scott, I was looking for a solution to load this popup from a link and haven't had any luck for some hours now. I tried your code but I'm not sure where to put the 2 parts. This first script part (about the embed.js) I put in my website header, the function part I tried everywhere. I run my website with wordpress so I tried in header, functions.php (this one crashes the site so I can't even test). Since you wrote the code to work with a button, can you give some directions where each part should be? Best, Fernando |
This comment has been minimized.
This comment has been minimized.
Thanks, it was helpful :) |
This comment has been minimized.
This comment has been minimized.
Konpa, did you manage to make it work? |
This comment has been minimized.
This comment has been minimized.
I'm getting a 404 in my console after clicking the button - requesting this url: |
This comment has been minimized.
This comment has been minimized.
If you are 404'ing, you may need to change the 'us11' in the url to 'us12'. Look at the Mailchimp generated code to see which URL you need to use |
This comment has been minimized.
This comment has been minimized.
that fixed the 404, thanks |
This comment has been minimized.
This comment has been minimized.
Anyone of you would mind to check my question? I'm not a coder so is a very basic question on where to put the code parts. best |
This comment has been minimized.
This comment has been minimized.
Hey MunizFo if you want it to work in a normal website (no wordpress) you will do this.
It will be something like like this. Subscribe to our mailing list <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> function showMailingPopUp() { require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"ad3626624633","lid":"37845629827345"}) }) document.cookie = "MCEvilPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; }; document.getElementById("open-popup").onclick = function() {showMailingPopUp()}; </script>This is just an example. Hope it works for you. If you cant see the code check this link: https://gist.github.com/anonymous/d831d139d95b18eeffaf |
This comment has been minimized.
This comment has been minimized.
Hi, I'm getting an error that says "Uncaught TypeError: Cannot set property 'onclick' of null". Any help? I have the script in the body and then defined the ID for an tag. |
This comment has been minimized.
This comment has been minimized.
Thanks Scottmagdalein, this helped quite a bit. As a side note, I had to delete the cookie entirely to get the popup to continue to function properly. Setting it null or expired didn't work consistently across browsers for me. I just used jquery.cookie.js,, since my site requires jquery already. That code is as follows: MunizFo, the cookie issue may be something worth trying. |
This comment has been minimized.
This comment has been minimized.
Does anyone know why the MCEvilPopupClosed cookie just won't get deleted?
No caching plugin working, tried in both firefox and chrome, from different computers and mobile,.... BUT: This damn MCEvilPopupClosed cookie won't go away after mailchimp created it! It has the word "evil" in its name, is that why? |
This comment has been minimized.
This comment has been minimized.
@digitaldumbo if you're still looking for help, you can avoid the "Uncaught TypeError: Cannot set property 'onclick' of null" issue by moving the code to the footer, just before the Also a tip that everyone will probably figure out eventually on their own, but make sure when configuring the popup on the MailChimp site that you set the popup to open "Immediately." Any delay you select will still happen after you click the button. |
This comment has been minimized.
This comment has been minimized.
I'm having trouble...I've put the code on a blog page, and it shows up on each post (so there are several buttons on the page). The button on the first post works great, but the second, third, etc. buttons do not open. How can I adapt this so it works every time, not just the first time it is clicked? |
This comment has been minimized.
This comment has been minimized.
Hi |
This comment has been minimized.
This comment has been minimized.
@RealDavidoff, you need to change the 'document.cookie' line like this:
You can learn more from here (shamless self-link) http://dmitriilin.com/track-pop-up-impressions-in-google-analytics-via-google-tag-manager/#6 |
This comment has been minimized.
This comment has been minimized.
@sarahjbray I'm having the same issue, did you manage to solve it eventually? |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Thanks this is working great on a wordpress site! |
This comment has been minimized.
This comment has been minimized.
@sarahjbray and @nevosegal Same as you guys. Any solution ? |
This comment has been minimized.
This comment has been minimized.
Found if !!! juste change the document.cookie line by this : document.cookie = 'MCEvilPopupClosed=;path=/;expires=Thu, 01 Jan 1970 00:00:00 UTC;'; credit : @quarrazzella ( Thank you a lot dude ). Hope that going to help |
This comment has been minimized.
This comment has been minimized.
Hi Guys, I copied both snippets, changed the id's, and the cookie line, and put them both in one custom code module. If i change the code of the module to the original mailchimp code, the pop up loads as suspected, on every pageload. Do I have to put the second snippet in an other place? (same question as MunizFo i guess) Much appreciated, EDIT: Figured it out.
Works perfectly! Thnx guys for this great snippet. |
This comment has been minimized.
This comment has been minimized.
I have the same question as @MunizFo . What is the proper way to include JS with a wordpress installation? I tried putting both the scripts in the site header and it didn't work... Would appreciate detailed instructions for anyone who got this working on a Wordpress site.. |
This comment has been minimized.
This comment has been minimized.
Hi, Please help. |
This comment has been minimized.
This comment has been minimized.
I have gotten it working in Chrome 55, and I added an async defer to make initial page load faster if you want to include these scripts in the head. I had to update the baseUrl, uuid, lid, add click handler after doc load, and used @quarrazzella 's method for clearing the cookie. My issue is that each time you hit the button, the "require" (I think this is the root cause anyways) in the popup function causes another script line to be appended to the document's head. I don't think it is re-fetching the script, but it does seem to bloat the head a bit. It's not a real issue, but it is curious why it happens. <script async defer 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>
function showMailingPopUp() {
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"UPDATE_ME","uuid":"UPDATE_ME","lid":"UPDATE_ME"}) })
document.cookie = 'MCEvilPopupClosed=;path=/;expires=Thu, 01 Jan 1970 00:00:00 UTC;';
};
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById("open-mailchimp-subscribe-popup").onclick = function() {showMailingPopUp()};
});
</script> |
This comment has been minimized.
This comment has been minimized.
Here's where I'm using this, so if I update this working script at all it'll change here - https://github.com/JTronLabs/Portfolio/blob/master/source/partials/_email_subscribe_popup.erb |
This comment has been minimized.
This comment has been minimized.
For people trying to make this work in wordpress, I tweaked it a little bit (it can be placed directly in any post):
|
This comment has been minimized.
This comment has been minimized.
@JCLaHoot - I'm working on a wordpress.com free site. Do you know where you can insert that code so that it is not just unformatted automatically by wordpress? I have tried adding the script to the code section of the MailChip widget and to a text widget with no success. |
This comment has been minimized.
This comment has been minimized.
@emmaleigh - sites on wordpress.com don't seem to work the same way as ones made from wordpress.org stuff (this was a huge source of confusion for me). I've never used wordpress.com though, so I'm not sure if the feature you need is just hidden somewhere. |
This comment has been minimized.
This comment has been minimized.
-.- I just noticed that Wordpress wipes out my onClick="showMailingPopUp()" whenever I go into the visual editor... It works if I publish directly from the text view though... |
This comment has been minimized.
This comment has been minimized.
Guys, what if I only want to delay the popup? (at least 30 seconds would be cool) |
This comment has been minimized.
This comment has been minimized.
I've testing in a wordpress page and nothing happens when i click the button. looking at inspect tab i see: |
This comment has been minimized.
This comment has been minimized.
A little thing I'd like to add to this thread: With the above solution I experienced a long-ish delay on the click. You can actually pre require the library without triggering the pop-up just like this |
This comment has been minimized.
This comment has been minimized.
Hi, I am trying to implement the mailchimp popup form for a Wordpress site of mine. This is proving to be difficult as the mailchimp script crashes a few other plugins of mine. I found a code to fix this on github: `<script>
</script>` This works but is missing the document.cookie so the popup form appears randomly. Basically I am having trouble combining these two codes together, issue been
Heres the two codes: `<script> `<script>
</script>` The site is www.weathertex.com.au Any help will be much appreciated! P.s. Sorry I am having trouble embedding the code in my comment. |
This comment has been minimized.
This comment has been minimized.
Hi, Since writing above comment the issue is now only when using the code by @JCLaHoot the onclick button only works on the homepage? When the button is clicked, the popup form appears but the close button (X) doesnt work. |
This comment has been minimized.
This comment has been minimized.
Thanks @ thaaveragedev, @ scottmagdalein, and everyone that added to this thread. I was attempting to use this method for a landing page and kept running into a dead end. Fortunately, after using Google, I located the issue. I had to add the following: onclick ="showMailingPopUp(); return false;" to my CTA button. After applying the above, everything worked fine. Here is the resource with the answer. https://amazingandrea.com/blog/2016/5/2/setup-a-mailchimp-popup-to-open-on-button-click |
This comment has been minimized.
This comment has been minimized.
Sorry to be a bit of a thicky, but did we end up with the definitive right code for Wordpress? Andrew |
This comment has been minimized.
This comment has been minimized.
This code still doesn't work for me in IE and Safari. What is your experience? |
This comment has been minimized.
This comment has been minimized.
It is worth adding that you need to place this at the bottom of your HTML jsut before the
|
This comment has been minimized.
This comment has been minimized.
@quarrazzella still sets a cookie |
This comment has been minimized.
This comment has been minimized.
Seems they changed the cookie name, now needs to be:
|
This comment has been minimized.
This comment has been minimized.
I'm seeing an additional cookie after someone subscribes, so I'm also adding:
|
This comment has been minimized.
This comment has been minimized.
It worked for me, but I had to change the cookie name:
|
This comment has been minimized.
This comment has been minimized.
Sorry If I'm being a total noob, but how are you guys running require() in a browser? |
This comment has been minimized.
This comment has been minimized.
@playeren it looks like the require() is provided by Dojo which Mailchimp is using. See: http://downloads.mailchimp.com/js/signup-forms/popup/embed.js (it's ugly but search for 'require' and you'll see it is in there) |
This comment has been minimized.
This comment has been minimized.
Here is final code after reading all the comments and trying to make it work in a wordpress site. <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.us15.list-manage.com","uuid":"4be8a46fa632f97e6755d1f45","lid":"16b255d564"}) }) 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;'; ); </script> |
This comment has been minimized.
This comment has been minimized.
@epagogmbh, actually I found a missing
|
This comment has been minimized.
This comment has been minimized.
Using above code from @riandesign I'm running into the issue of require.js (like the ones above), but I can't resolve. I keep getting this error in Console: |
This comment has been minimized.
This comment has been minimized.
The last code works (posted on 30 Nov 2017). But I still can't close the pop-up clicking on the outside (the "black zone") or the "X" close button, like the mailchimp original one does. Anyone knows why? Thanks! |
This comment has been minimized.
This comment has been minimized.
@riandesign Also, reminder for everyone to double check the number on "mc.us16.list-manage.com". You may have a different one. Final JS code: Add this code to "footer.php"
HTML Button Code Note: This worked on wordpress |
This comment has been minimized.
This comment has been minimized.
@bradstr Thanks! This works. :) I placed the button near middle of the page but when it's clicked, the popup opens but jumps up to the top of the page. Does anyone know how to prevent that from happening? |
This comment has been minimized.
This comment has been minimized.
MailChimp might change the name of the cookie so I what I did was grab all the cookies from the document.cookies, split on (;), and iterate to either find one that has "MC" in its name and clear the expiration on that or if you don't have any other cookies set on the site, expire them all. |
This comment has been minimized.
This comment has been minimized.
I am attempting to use two buttons with different id's to open the same pop-up `<script> </script>` and `<script> document.getElementById("open-popup-cta").onclick = function() {showMailingPopUp()}; Is there a better solution to this , since I wish to have multiple buttons placed on important areas of the website. |
This comment has been minimized.
This comment has been minimized.
Thank you for this gist. |
This comment has been minimized.
This comment has been minimized.
@bradstr Thank you for the change. In my case the pop-up still appears when the page loads. Is there anyone else with the same behaviour? |
This comment has been minimized.
This comment has been minimized.
Got this working, however the I can click the button to call the pop-up over and over and a pop-up keeps popping up. On mobile this does not seem to be an issue but on desktop this creates an issue and the buttons do not seem to work if multiple instances of the pop-up have been called. is there a way to either make the button calling the pop-up not functional while the pop-up is still active. or to change the button to a "close the pop-up" button after click. |
This comment has been minimized.
This comment has been minimized.
The cookie got renamed and also the cookie is always on the root path, not the current one. So this is the updated line for the cookie:
|
This comment has been minimized.
This comment has been minimized.
Did anyone manage to make it work on a Jekyll powered site (Github Pages)? |
This comment has been minimized.
This comment has been minimized.
Hi I am trying to make this work on an exit pop-up - has anybody had any success? I am using html files etc in cPanel - it is not on a CMS at all. I have the following loaded but now no pop up happens at all. I was a pop up that would happen as soon as the mouse left the page but then the pop up does not show for another one year I was told by Mailchimp - how ridiculous!!! If anybody can help I would be so grateful. <script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
|
This comment has been minimized.
This comment has been minimized.
can anyone tell me, why the PopUp only works one time and then i have to remove the cookie to make it work again? |
This comment has been minimized.
This comment has been minimized.
Same problem here... The cookie is not resetting anymore.. Was working fine before. |
This comment has been minimized.
This comment has been minimized.
I'm having a strange thing happen. When I add the code to my footer.php, the file won't update/save. If I remove the line
It saves. What's the deal? I tried the
version as well. No joy. Any thoughts? |
This comment has been minimized.
This comment has been minimized.
I got this error
|
This comment has been minimized.
This comment has been minimized.
I'm getting the Invalid error, same as above. Anyone get this working? |
This comment has been minimized.
This comment has been minimized.
I just got this working, using this: <script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
<script type="text/javascript">
function showMailingPopUp() {
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"MY_BASE_URL","uuid":"MY_UUID","lid":"MY_ID"})})
document.cookie = "MCPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
document.cookie = "MCPopupSubscribed=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
};
$(function() {
$(".open-popup").on('click', function() {
showMailingPopUp();
});
});
</script> and <div class="d-flex justify-content-center">
<button class="open-popup btn btn-primary">Subscribe to our mailing list</button>
</div> Make sure your popup signup form is set to display "Immediately". And I had to actually leave the Mailchimp popup form screen in order for it to be properly published - just using the "Publish" button didn't seem to be enough. |
This comment has been minimized.
This comment has been minimized.
@digitalmoksha – that works great for me, thanks for posting. On mobile, a second 'subscribe' message appears by default. Mailchimp say:
This means when we click our button to open the subscribe form, on mobile, another banner appears from the top with another 'subscribe' button that needs clicking to open the subscribe form. Anybody know a way to bypass or disable this second mobile popup message? |
This comment has been minimized.
This comment has been minimized.
Just as an add-on to @scottmagdalein awesome work, here is a discussion you might find interesting for using this popup in conjunction with conflicting jQuery scripts (wordpress plugins for instance). It loads Mailchimp's script after the window has fully loaded (≠ from DOM loaded since the window also contains scripts). |
This comment has been minimized.
This comment has been minimized.
I have the same issue as voodoo6. This does not work for mobile devices. Is there any way to bypass the mobile banner? |
This comment has been minimized.
This comment has been minimized.
For anyone getting a window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"YOUR_BASE_URL","uuid":"YOUR_UUID","lid":"THE_LIST_ID","uniqueMethods":true}) }) The difference here is using |
This comment has been minimized.
This comment has been minimized.
this worked great for me! thanks for the help! |
This comment has been minimized.
This comment has been minimized.
They changed the cookie. It's now To remove it, you must do: For future reference, I found this out by modifying the document.cookie setter to output the string that was being set:
Another more robust solution might be to modify the cookie setter to block all cookies from being added when the popup is displayed (and saving the original getter/setter at the initial load to prevent mailChimp from shenanigans like overriding it themselves.) |
This comment has been minimized.
This comment has been minimized.
It would be phenomenal if someone could create a Wordpress plugin for this - for the no so code savvy- but interest persons |
This comment has been minimized.
This comment has been minimized.
Has this been figured out yet for wordpress? Should the script be enqueued instead of put in the footer? I have added every set of code on this page and the button still does nothing :( Has anyone figured out even a plugin for this to work?? |
This comment has been minimized.
This comment has been minimized.
Hello There, itried the code but nothing happened when i click on the button. I tried to replace the cookie line. I just want to call my mailchimp popup from a basic html page. Could someone can help me please. Here my javascript file: `<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> function showMailingPopUp() { require(["mojo/signup-forms/Loader"], function(L) { L.start({"aseUrl":"mc.us20.list-manage.com","uuid":"891ee23677206c2791f545fa9","lid":"969ee6cb4b","uniqueMethods":true}) }) document.cookie = "MCPopupClosed=yes;expires=Wed, 22 Jan 2020 00:11:31 GMT;"; }; document.getElementById("open-popup").onclick = function() {showMailingPopUp()}; </script>`Here my HTML page:
|
This comment has been minimized.
This comment has been minimized.
You need to check ur mailchimp widget settings as "Open Immediately", otherwise it won't work. |
This comment has been minimized.
This comment has been minimized.
I cannot get this to work. Don't know how many times I can cut and paste with same result. Nothing happens when I click on my Subscribe button. MailChimp outputs this:
fwiw, this works automatically, but I want it to to work on-click obviously. I'm modifying as such:
putting this in the body
I've tried changing the baseUrl to match, changing the embed.js source to match. I've tried putting it in just a blank html file to see if something was interfering. Seems so simple, but I can't get it working. Thanks |
This comment has been minimized.
This comment has been minimized.
Awesome! Thank you. I've updated the original code.
|
This comment has been minimized.
This comment has been minimized.
This example doesn't appear to work after replacing the MailChimp Ids and adding the scripts to the |
This comment has been minimized.
This comment has been minimized.
If anyone is still using this, it might be helpful to know that you should delete 2 cookies to get the popup to show on click:
They're defined in _hasCookies in popup.js. Also - I put this before window.dojoRequire. |
This comment has been minimized.
This comment has been minimized.
To combine several posts above here is the showMailingPopUp function which worked for me function showMailingPopUp() {
// If your mailchimp popup tried loading automatically, but had a cookie and did not show
// If not done, close button would not work (sorry for jQuery) -- basically removes previous popups
$('[id^="PopupSignupForm"]').remove();
// clear 2 cookies on the root path
document.cookie = "MCPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
document.cookie = "MCPopupSubscribed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
dojoRequire( // using uniq methods, some older code may work with simple require
["mojo/signup-forms/Loader"],
function(L) {
L.start( {
"baseUrl":"XXXX.usXX.list-manage.com",
"uuid":"YOUR_USERID",
"lid":"YOUR_FORM_ID",
"uniqueMethods": true // force using uniq methods inside, otherwise will complain about "require/define not defined"
});
});
}; |
This comment has been minimized.
This comment has been minimized.
@tairli, I am also getting same issue, I want to know from where you got uuid and lid? You can check here I ask question on stack overflow. can you help me out with this? |
This comment has been minimized.
This comment has been minimized.
@Naren-hybreeder
parameter U is UUID (which is 0f6d154d46c829d7990000000 in the example above) and ID is the form id (which is 0d65b50000 in the example). |
This comment has been minimized.
This comment has been minimized.
I am not getting the form code in Mailchimp.
I have below code but it's not working
|
This comment has been minimized.
This comment has been minimized.
Did anyone get this to work? |
This comment has been minimized.
This comment has been minimized.
Hey y'all. I'm still using my original code and it appears to be working well. If you need a link to a working example, let me know. I'll send a private DM |
This comment has been minimized.
This comment has been minimized.
thanks. hi. I paid the 49 dollars/year and got it working. Still having a bit of time with
getting everything ELEMENTOR to work with mailchimp. but thanks.
On Jan 24, 2020, at 9:06 AM, Ryan Labelle ***@***.***> wrote:
Hey y'all. I'm still using my original code and it appears to be working well.
If you need a link to a working example, let me know. I'll send a private DM
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <https://gist.github.com/259d878ad46ed6f2cdce?email_source=notifications&email_token=AK6ZT2JH7HUW3PPNW2DO6L3Q7MNY3A5CNFSM4HQROL2KYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAGANS6#gistcomment-3152687>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AK6ZT2IE2TT7LIH33MU5DU3Q7MNY3ANCNFSM4HQROL2A>.
Ray Mikota
541.261.8850
mikotadesigngroup.com
|
This comment has been minimized.
This comment has been minimized.
Can you share your code with me? Can you check my code as well? I tried my code I am not getting the popup after clicking on button. |
This comment has been minimized.
This comment has been minimized.
My original code is in this tread already. https://gist.github.com/scottmagdalein/259d878ad46ed6f2cdce#gistcomment-2929907 Sorry, I can't check your code. I wish had more time to help out. |
This comment has been minimized.
This comment has been minimized.
I tried the same code but it's not working. I don't know where is the issue. I tried to display the alert on the click, It is displaying but popup not displaying. |
This comment has been minimized.
This comment has been minimized.
Sorry, I wish I could help. Perhaps someone in this thread has a solution? |
This comment has been minimized.
This comment has been minimized.
I can confirm this is working for me as of the date of this comment: <script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
<script type="text/javascript">
window.openMailchimpPopup = function() {
window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"YOUR_SERVER_BASE_URL","uuid":"YOUR_UUID","lid":"YOUR_LIST_ID","uniqueMethods":true}) })
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;';
}
</script>
<a class="mailchimp-subscription-block__button" onclick="openMailchimpPopup()">SUBSCRIBE</a> I found the secret behind this to be searching for mailchimp cookies (usually |
This comment has been minimized.
This comment has been minimized.
@heitoralthmann solution works here |
This comment has been minimized.
This comment has been minimized.
Copy and pasted code from @heitoralthmann but still can't get the JS file
|
This comment has been minimized.
This comment has been minimized.
@ilium007 I believe you should be loading Double check the |
This comment has been minimized.
This comment has been minimized.
Could I also add to the list of code suggestions? I've been trying with a bit of code that works both on WordPress and stand alone pages and I seem to have successfully integrated it with a timer of sorts. So a user visits the page, it waits for a fixed duration of time (3s in this case) displays the form and then if the user cancels but then decides that they do want to subscribe, I have added a button for them to get that form back. If they click the 'subscribe-toggle' button so the form appears, but then refreshes/revisit the page the form should re-appear automatically again after 3 seconds. Notes: Script requires jQuery, won't work from local computer file system, needs to be hosted on a web service.
|
This comment has been minimized.
This comment has been minimized.
@heitoralthmann Thank you for that! Mailchimp needs add an event listener soon! |
This comment has been minimized.
This comment has been minimized.
@heitoralthmann `<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script> <script type="text/javascript">window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us10.list-manage.com","uuid":"","lid":"","uniqueMethods":true}) }) 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;';}</script>` |
This comment has been minimized.
This comment has been minimized.
Hi there! Here the code I used:
Does someone have the solution to this problem? |
This comment has been minimized.
This comment has been minimized.
This code really saved me! It does exactly what I wanted. |
This comment has been minimized.
This comment has been minimized.
I'm confused as to where you all are getting the popup form code in mail chimp? My mail chimp just asks if I want it turned on and to connect the site and does not deliver the code. Where would I find that? |
This comment has been minimized.
This comment has been minimized.
Hi there, as far as I've experienced recently in one of our projects, this "window.dojoRequire" option is not longer possible since 16 June 2020 and it just throws an error and conflicts with some other JS code :( . Has anyone had same issue? |
This comment has been minimized.
This is a modified version of the script that Mailchimp gives you when you create a Subscriber popup form for collecting emails on your website. Currently, Mailchimp's popup only displays one page load (or with a slight delay depending on your preferences). This snippet will allow you to launch the popup when any element with the #open-popup ID is clicked.
The cookie is set on line 6 to expire the session that Mailchimp attempts to create. This ensures the popup will be able to appear even after the popup is exited.