7 Replies Latest reply on Jun 25, 2014 9:35 AM by Dan Stevens

    URL parameter script not working in Forms 2.0

    Dan Stevens
      This resource article (https://community.marketo.com/MarketoResource?id=kA650000000GuKCCA0) provided us with the necessary guidance to properly pass URL parameters – in our case, referring URL – to our iframed forms.  But this is a forms 1.0 artilce and this no longer works in Forms 2.0.  I would expect Marketo to update this since most of us are probably using Forms 2.0.

      The script is contained below and what we included on the iframe landing page:
       
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
      <!-- Keep your jQuery up to date -->
       
      <script>
       
        $(function(){
          var url = (window.location != window.parent.location) ? document.referrer: document.location;
          var sourceParam = getUrlVars(url)["ref"];
          $("#Avanade_Referral_URL").val(sourceParam);
        })
         
        function getUrlVars(url) {
          var vars = [],
              hash;
          var hashes = url.slice(url.indexOf('?') + 1).split('&');
          for (var i = 0; i < hashes.length; i++) {
              hash = hashes[i].split('=');
              vars.push(hash[0]);
              vars[hash[0]] = hash[1];
          }
          return vars;
        }
       
      </script>
       
      Our contact-us page is located here: http://www.avanade.com/en-us/pages/contact.aspx

      D
      oes anyone have any suggestions/fixes for this?