How do I add the Javascript code from Mailchimp for subscriber pop-up?

Hi,

I have added the javascript code to JS section of the page I need the pop-up to work on but its not working.

Is there anything else I need to add? I see on some posts add ons are needed.

Advice would be appreciated.

Code here:

<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">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us17.list-manage.com","uuid":"218cd92de85b2307d42ecaafa","lid":"5ef6dae02d"}) })</script>

I also removed the script types at the beginning and the end but it’s still not displaying.

Advice appreciated.

Hi There,

I’ve tested that code and it seems to work fine on my end:

Could you please try adding that code to text element instead?

Let us know how it goes!

1 Like

It works if I add a new section on the page and then drop the code in there as raw, although this stops the rest of the page loading correctly.

Can you show me the code to add it to Custom JS section?

Hi, I have added the code now as a ‘section’ for you to see how the page loads.

Images and the classic feature do not load properly.

Hi,

The js script seems to be conflicting.

Instead of adding the raw code from mailchimp, please use convertplus plugin and connect it with your mailchimp account.


Hope that helps.

There isn’t a ConvertPlus plugin coming back in my search results?

There are:

Mail chimp for Wordpress
Contact form for Mailchimp extension
Mail chimp Subscribe form

Possibly the latter? do you have the authors name?

Please advise.

Regards

James

Now I cant even access my admin page:

Receiving this error:

Warning: max(): Array must contain at least one element in /home2/pumpandflex/public_html/wp-content/plugins/contact-form-7-mailchimp-extension/lib/tools.php on line 119

Warning: Cannot modify header information - headers already sent by (output started at /home2/pumpandflex/public_html/wp-content/plugins/contact-form-7-mailchimp-extension/lib/tools.php:119) in /home2/pumpandflex/public_html/wp-includes/pluggable.php on line 1210

Worked out myself how to delete plugins via file manager of host.

Still need advice on how to integrate with mail chimp and preferred plugin though.

Very slow process indeed :frowning:

Hello There,

Thanks for updating in! When you insert your code in a raw content element, it works. When added in the custom js section, it doesn’t because it creates a JS error. Inserting the same code in the custom JS will create issue because there is be unclosed <script> when being outputted in the live page. Please understand that the custom js will only accept jQuery code. Adding a <script> will invalidate all the js code. To resolve your issue, you will have to use this code instead:

</script>
<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">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us17.list-manage.com","uuid":"218cd92de85b2307d42ecaafa","lid":"5ef6dae02d"}) })

The closing script will closed the script tag of the custom js and your code will use the closing script of the custom js as well. I know this might be confusing but this is the only way you can insert a code with a script tag in the custom js section.

Hope this make sense.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.