Mail chimp embed with popup and subscribe button
-
Hi,
I am trying to embed a mail chimp popup subscribe form into one of my clients sites.
Using the normal embed code that Mailchimp provides does not work because of certain other plugins, plus WordPress doesn’t like it too much.
Luckily I found a nice solution on Github. It makes sure the Mailchimp script is run last. You can see below.
<script> // Fill in your MailChimp popup settings below. // These can be found in the original popup script from MailChimp. var mailchimpConfig = { baseUrl: 'mc.us1.list-manage.com', uuid: 'b0c26b04265a39ba24824ebbf', lid: '7546ef513d' }; // No edits below this line are required var chimpPopupLoader = document.createElement("script"); chimpPopupLoader.src = '//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js'; chimpPopupLoader.setAttribute('data-dojo-config', 'usePlainJson: true, isDebug: false'); var chimpPopup = document.createElement("script"); chimpPopup.appendChild(document.createTextNode('require(["mojo/signup-forms/Loader"], function (L) { L.start({"baseUrl": "' + mailchimpConfig.baseUrl + '", "uuid": "' + mailchimpConfig.uuid + '", "lid": "' + mailchimpConfig.lid + '"})});')); jQuery(function ($) { document.body.appendChild(chimpPopupLoader); $(window).load(function () { document.body.appendChild(chimpPopup); }); }); </script>This worked a treat.
I am also trying to add a subsribe button which will trigger the mailchimp pop up form. I found a seperate code for this but it does not work with the code featured above.
Please Help!
Hope this all makes sense.
Regards,
Chris
- The topic ‘Mail chimp embed with popup and subscribe button’ is closed to new replies.