Adding Mailerlite JS to Wix - for on click pop-up

Hello - I’m trying to figure out how to add 3 things to my wix site to have it show an on click pop-up from MailerLite.

1 - add JS to the head tag right before closing to go on all pages
2 - add a snippit of JS to the specifi page for the pop up
3 - add in the html so that a button I already have on wix page is clickable to this pop up.

Thank you!

Have a read of this page if not already done so and think about using Wix own email marketing.
https://support.wix.com/en/article/adding-an-external-email-marketing-platform

What you are most likely looking to need to do is to add a block of html code to a custom tool in your Tracking and Analytics section. Then add an additional block of html code in a html iframe on your actual page where it is needed.
https://support.wix.com/en/article/embedding-custom-code-to-your-site

Plus, depending on what you are using MailerLite for, I would thoroughly suggest that you look at authenticating yourself too.
https://help.mailerlite.com/article/show/62599-how-to-authenticate-domain-with-wix

Plus, for a more secure option than using html code, I would suggest that you look at using API too.
https://help.mailerlite.com/article/show/29273-double-opt-in-for-api
https://developers.mailerlite.com/docs

For API connections look at using Wix Fetch or Wix HTTP Functions.
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions

Example: https://www.wix.com/corvid/forum/wix-tips-and-updates/example-myapi-and-myapiclient

@givemeawhisky and/or other Velo Experts, I’m having a similar problem. I can’t get a Mailerlite (ML) script-based form to populate on my website.

  • I have published my domain.

  • I have authenticated my Wix site with ML.

  • I have included the script markup (provided to me by ML) in my site’s head tag. I did this from my Wix dashboard: Settings | Advanced section.

  • I added a button to my Wix home page with the markup provided by ML (shown below with some redaction)
 <button onclick="ml_account('webforms', 'XXXXXX', 'XXXXX', 'show')">
  Click here to show popup
</button>

The onclick event fails. The console throws a ReferenceError. ml_account is not defined.

I tested ML’s code and instructions with a small “hello world” HTML file on my local machine: it works. From inspecting my live sites DOM elements, and comparing it to my local test, an iframe is missing from the page - generated I presume by the custom code. I’m assuming the custom code is not firing in the head tag.

I know you’d prefer it we used your email marketing tools, but I came to you with my ML relationship already established. Any help you can offer would be greatly appreciated.