[Support request] Defer loading of GP element script

Home Forums Support [Support request] Defer loading of GP element script

Home Forums Support Defer loading of GP element script

  • This topic has 5 replies, 3 voices, and was last updated 1 year ago by Tom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1462043
    Junior Gong

    Hey guys

    for our email optins we are using mailerlite popup forms which we added as a gp element
    Is there any way to defer the loading?

    #1462163
    David
    Staff
    Customer Support

    Hi there,

    can i see the site where the script is hooked in so i can take a look?

    #1478301
    Junior Gong

    Sure. It’s in private info in this reply

    #1478385
    David
    Staff
    Customer Support

    Can you provide a copy of the code you’re adding to the Element ( You can delete any API Keys from the code ).

    #1480248
    Junior Gong

    Sure

    <!-- MailerLite Universal -->
    <script>
    (function(m,a,i,l,e,r){ m['MailerLiteObject']=e;function f(){
    var c={ a:arguments,q:[]};var r=this.push(c);return "number"!=typeof r?r:f.bind(c.q);}
    f.q=f.q||[];m[e]=m[e]||f.bind(f.q);m[e].q=m[e].q||f.q;r=a.createElement(i);
    var _=a.getElementsByTagName(i)[0];r.async=1;r.src=l+'?v'+(~~(new Date().getTime()/1000000));
    _.parentNode.insertBefore(r,_);})(window, document, 'script', 'https://static.mailerlite.com/js/universal.js', 'ml');
    
    var ml_account = ml('accounts', 'xxxx', 'xxxx', 'load');
    </script>
    <!-- End MailerLite Universal -->
    <script>
        var ml_webform_xxxx = ml_account('webforms', 'xxxxx', 'xxxxxi', 'load');
        ml_webform_xxxxx('animation', 'fadeIn');
    </script>
    #1481050
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Is this script already loaded in the footer? If so, there’s no need to defer it – it’s deferred by default as it only loads when it’s reached at the end of the page.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.