Embedding MailChimp Popup into Shopify Theme

Andrew_Hilson1
New Member
3 0 0

Hi, I'm sure there is already a thread on this, but I can't seem to figure out how to embed a MailChimp popup (code generated) into the Pop theme from Shopify.

 

All I want it to do is popup on the homepage.  And I can't sort it out.  It doesn't seem user friendly...but maybe I'm missing something.

0 Likes
Alida_W
Shopify Staff
Shopify Staff
27 0 2

Hey Andrew!

Alida here from Shopify. Welcome to the forum!

Do you want the pop-up to only trigger on the homepage? If so, you'd want to add it into your index.liquid, at the very bottom of the current template:

If it's reliant on Javascript to run, be sure to wrap it in script tags if they aren't provided, like in the example below:

<script> 
/* Mailchimp popup goes here */
</script>

If you want it to trigger on any page, provided it's the first page a customer sees upon arrival, you would instead add it to the bottom of the theme.liquid.

Hope this helps! 

-Alida

0 Likes
Jeff_Nissen
Shopify Partner
3 0 1

When I paste the script code into the theme.liquid page and refresh the website, all my links become inactive. I'm placing the code at the bottom of the page before the closing body tag. Is that incorrect?

Emma_Lovell
New Member
6 0 0

Hi Jeff - did you get an answer on this? This is exactly what's happening to me??

 

0 Likes
Happy2Day
Shopify Partner
32 0 0

Bump

 

Anyone?

0 Likes
Alida_W
Shopify Staff
Shopify Staff
27 0 2

Hey pals! 

Sorry about the lack of response here!

Since my last post, Mailchimp has changed their JavaScript, so pasting it in the index.liquid no longer works, as it will load before the theme-reliant JavaScript and prevent normal theme functions from loading. Yikes!

 

The solution here is to find the closing </body> tag in the theme.liquid; it should be the second to last line. Then, you can paste your MailChimp pop-up script here. 

If you want it to only fire on the homepage, you can wrap it in conditional formatting like so:

{% if template == 'index' %}

<script>

// mailchimp popup script goes here

</script>

{% endif %}

</body>

Hope this helps!

0 Likes
Brendin
Shopify Partner
200 0 29

Hi Alida,

Not to steal the thread, but I tried added the mailchimp popup JS to a site a couple of weeks ago and i was running into an issue. I just tried to re-upload the JS but still having issues.

Im getting a "multipledefine error" with a "src: dojoLoader" in the console. Have you had any troubles with this before? It only happens when I include the JS code from Mailchimp.

If my hunches are correct, I would assume the issue would be on Mailchimp's side. But I figured i'd ask and see if anyone has come across the same issue.

thanks!
Brendin

Hire Me! - I am available to customize your Shopify store.
0 Likes
Will46
New Member
2 0 0

Hey Alida!

Thank you for your very responsive and helpful threads.

Just to clarify, this is what you meant with the last instructions, correct? 

 

0 Likes
Will46
New Member
2 0 0

If so, it's still a mystery to me :D 

0 Likes
Alida_W
Shopify Staff
Shopify Staff
27 0 2

Hey Will!

 

I apologize! Sometimes, JavaScript is provided like so: 

$(function() {
  CSbuttons.cache = {
    $shareButtons: $('.social-sharing'),
  }
});

And would then need to be wrapped in <script> and </script> tags. 

However, if you get code like so: 

<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 type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us14.list-manage.com","uuid":"XXXXXXXXXXXXX","lid":"XXXXXXXX"}) })</script>

then the script tags have already been explicitly provided, and it doesn't need to be wrapped in additional script tags. That was an error on my behalf, and I apologize for the confusion!

0 Likes