CSS AND STYLING

Resources

SCRIPTS AND HACKS

ghl-experts-logo-light
  • CSS AND STYLING

    RESOURCES

    SCRIPTS AND HACKS

  • Embed Form with UTM Parameters

    This script will allow you to embed a form on any external website and retrieve the UTM Parameters like “utm_source”, “utm_campaign”, etc.. and pass them into hidden fields within the form.

    Supported UTM Parameters:

    utm_source, utm_medium, utm_campaign, utm_term, utm_content

    If you don’t already have an account, please sign up to become a member

    <!-- /**************************
    	* Copyright 2020 GHL Experts, All Rights Reserved
    	* Do not share, or distribute this code without author's consent.
    	* This copyright notice must remain in place whenever using
    	* this code - DO NOT REMOVE
    	* Author: Anas Uddin
    	* Website: https://ghlexperts.com
    **************************/ -->
    <div id="iframe-container"></div>
    <script>
      let formId = '' // Add form ID here
      let formHeight = '400px' // Change form height if required here
      
      // DO NOT CHANGE ANYTHING BELOW
      function getURLParameter(e){return decodeURIComponent((RegExp(e+"=(.+?)(&|$)").exec(location.search)||[,null])[1])}
      let utmParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content']
      let formUrl = 'https://msgsndr.com/widget/form/'
      let formJs = 'https://msgsndr.com/js/form_embed.js'
      let urlParams = '?'
      
      for (let param of utmParams) {
        getURLParameter()
        let urlTerm = getURLParameter(param);
        if (urlTerm.trim().length > 0 && urlTerm != "null") {
          urlParams += `${param}=${decodeURIComponent(urlTerm).replace(/\+/g,' ')}&`;
        }
      }
    
      let ifrm = document.createElement('iframe');
      ifrm.setAttribute('id', formId);
      ifrm.setAttribute('src', formUrl + formId + urlParams);
      ifrm.setAttribute('scrolling', 'no');
      ifrm.setAttribute('style', 'border:none;width:100%;height:' + formHeight);
    
      let s = document.createElement('script');
      s.type = 'text/javascript';
      s.src = formJs;
    
      var el = document.getElementById('iframe-container');
      el.appendChild(ifrm, el);
      el.appendChild(s, el);
    
    </script>

    Welcome to GHL Expert Tools

    We are still in the process of finalizing all of our trainings and setup instructions. If you need help in the meantime, please join our Facebook Group.

    Join our Facebook Group

    Join our Facebook Group to get support, platform insights, ask questions and receive updates.

    Latest Update

    Visit our changelog page to see our most recent update.

    FOMO

    Capture leads before they leave the page by creating
    entincing offers that create a fear of missing out.

    Affiliate area

    Join our affiliate program to earn commissions when you refer people to GHL Experts

    © 2020 GHL Experts. All Rights Reserved. Made with Love from Montreal

    This site is not a part of the GoHighLevel website or HighLevel, LLC. Additionally, this site is not endorsed by GoHighLevel in any way. GoHighLevel is a trademark of HighLevel, LLC