\r\n\r\n","answerCount":1,"datePublished":"2018-01-19T15:34:58+00:00","author":{"@type":"Person","name":"Nicholas","url":"https://toolset.com/forums/users/nicholasa-2/"},"acceptedAnswer":{"@type":"Answer","text":"We currently have no solution for this as this script was not meant to work with wordpress or wasn\\'t made wordpress compatible because even on a clean installation with non of our plugins the issue was still present where the script was generating errors in the console.\\n\\nThe alternative is to use the embedded form or a mailchimp form plugin to have your subscription form.","datePublished":"2018-02-13T17:57:55+00:00","upvoteCount":1,"url":"https://toolset.com/forums/topic/mailchimp-pop-up-form-script-is-breaking-view/","author":{"@type":"Organization","name":"Toolset","url":"https://toolset.com"}}}}} Skip Navigation

[Resolved] Mailchimp Pop Up Form Script is breaking view

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here was that the customer wanted to apply the mailchimp popup form script to his wordpress through an example code provided from mailchimp.

<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":"144e2b841120da1b2d05b4e05","lid":"f7f8eb5e63"}) })</script>

Solution:

We currently have no solution for this as this script was not meant to work with wordpress or wasn't made wordpress compatible because even on a clean installation with non of our plugins the issue was still present where the script was generating errors in the console.

The alternative is to use the embedded form or a mailchimp form plugin to have your subscription form.

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 27 replies, has 2 voices.

Last updated by Nicholas 6 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#612918

Yes you can do all of those things. Update and deactivate the toolset plugins.

If you place my code inside of a codepen hidden link you'll see how it works. No problem there.

Did you check the console of the page I had sent you where I placed the mc code?

#613421

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicholas,

I'm having some issue with installing a testing this code.

Just to confirm that this was generated from your mailchimp account ? Could you generate a fresh copy of the script and paste to me ?

Also could you install the twentyseventeen wordpress theme on the site as well .

Thanks,
Shane

#613475

Yes, this code was generated through MailChimp. If you are having trouble you can generate that code for yourself on MailChimp. MailChimp is free.

Here's my code again.

<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":"144e2b841120da1b2d05b4e05","lid":"18f30240e9"}) })</script>

You can test this code in codepen.io. It works. The pop up will trigger if you try to exit the screen. It's an exit intent pop up.
hidden link

And since you allowed yourself to install a plugin I think you can change the theme as well. I am sure you know how that works. Please go ahead and do it ?

Please check the console on the page I sent you where the popup is not showing. The code is interfering the toolset plugins.

#613817

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicholas,

Thanks for the clarity.

I'm still working on this for you but I must apologize for the delay.

However might I ask if there is any alternative method for this form such as embedding it directly to the page itself instead of in a popup ?

In some more detail with the toolset plugins disabled there as still this error being displayed in the console

embed.js:6 GET <em><u>hidden link</u></em> 404 (Not Found)
p.getText @ embed.js:6
ra @ embed.js:23
b @ embed.js:2
(anonymous) @ embed.js:11
ka @ embed.js:20
oa @ embed.js:11
(anonymous) @ embed.js:24
b @ embed.js:2
Ya @ embed.js:24
e @ embed.js:22
(anonymous) @ embed.js:26
(index):464 Uncaught TypeError: Cannot read property 'setDefaults' of undefined
    at HTMLDocument.<anonymous> ((index):464)
    at i (jquery.js?ver=1.12.4:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
    at Function.ready (jquery.js?ver=1.12.4:2)
    at HTMLDocument.K (jquery.js?ver=1.12.4:2)

Also it seems that jquery for the script isn't loading so i'm not sure what else to do since with the plugins disabled this is still the case. I've even tried it on a fresh wordpress install with non of our plugins installed and the result is still the same.

Please let me know.
Thanks,
Shane

#613834

No, unfortunately not. It's the only method suggested in the docs and this is also the only code that will be generated through MailChimp.

Did you check the codepen I had sent you? It works there without any issues if you're trying to leave the site. (exit intent popup)

hm...

#613882

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicholas,

Yes i saw it working on codepen without any issues.

What I can do is to seek some helps with this from our 2nd tier supporters to see if they can identify whats wrong.

Thanks,
Shane

#614699

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicholas,

After some extensive testing, i've come to the conclusion that the popup form is not meant to be used in wordpress. They actually use the embedded forms for wordpress.

So the best option to get a popup is to use the boxzilla plugin
https://wordpress.org/plugins/boxzilla/#description

And the embedded forms to do the popup.

Thanks,
Shane

#614703

may I ask why it's not meant to be used in WordPress?

#615282

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicholas,

Sure its because its throwing a 404 when its importing the js script for the popup. So it needs to be modified in order to work. The embedded form was made to work universally and as mentioned you can create n embedded form and add it to the boxzilla plugin popup to get a similar effect.

Thanks,
Shane

#615365

I found the following blog posts trying to solve the problem
hidden link
hidden link
hidden link

#615368

So I got it to work with this trick
hidden link

However, it still breaks the toolset views and I still get the same error messages in the console.

#615419

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicholas,

I see this method does indeed provides a solution for the popup but as mentioned this script doesn't seem to be meant to work on wordpress hence why such a solution was provided.

Usually scripts are kept separate because each plugin loads its own dependencies and will cause conflicts if not loaded within their own containment.

This script is actually causing issues with our dependencies because its not written to be referenced only by the script instead if it loads before our scripts for views and layouts then this issue will occur.

Its not just limited to our plugins but I noticed that the same issue occurs with the script and the woocommerce plugin as well. I'm not sure what exactly we can do about this but the script has to be wordpress compatible.

This would need to be resolved on the side of mailchimp.

Thanks,
Shane

#615758

ok thanks