2

当我提交市场表单时,它将定位到这个 iframe。

因此,我需要将 url 参数传递给 iframe 以确保在提交表单时,隐藏字段会自动从 url 参数中获取值。但是在这个 iframe 上,如你所见,它没有 src。我曾尝试将此添加到 iframe:

$("#mktoformhidden").src = window.location.href;

但效果不好。

iframe src 应该在这里是什么?

谢谢,

4

3 回答 3

2

我会做这样的事情!只需将“URL HERE”替换为您的 iframe 网址,当然还要更新您在两个位置所需的大小。

<noscript>
 <iframe src="YOUR URL HERE" width="100%" height="500" type="text/html" frameborder="0" allowTransparency="true" style="border: 0"></iframe>
</noscript>

<script type="text/javascript">
 var iframeurl = 'YOUR URL HERE';
 var params = window.location.search;
 var thisScript = document.scripts[document.scripts.length - 1];
 var iframe = document.createElement('iframe');

 iframe.setAttribute('src', iframeurl + params);
 iframe.setAttribute('width', '100%');
 iframe.setAttribute('height', 500);
 iframe.setAttribute('type', 'text/html');
 iframe.setAttribute('frameborder', 0);
 iframe.setAttribute('allowTransparency', 'true');
 iframe.style.border = '0';

 thisScript.parentElement.replaceChild(iframe, thisScript);
</script>

于 2018-03-12T12:59:25.280 回答
1

My guess is that an iframe is not the best solution here. The iframe can create all sorts of cross site scripting and permission based concerns.

Why not just use the new forms functionality in Marketo so you can drop the form either on a landing page or embed on your site (they come with an embed source code).

Also, the munchkin tracking code automatically grabs "query" parameters so you can use those in smart lists or reporting.

于 2014-03-09T08:19:01.077 回答
1

就像sahutchi 的那样,将实际的 Marketo表单嵌入到您的网站中可能是可行的方法。我选择了 iframe 方法来让 Marketo 自动填写基于mkt_tok. 使用 Marketo 表单可能会实现这一点,但我在一两个月前无法弄清楚。

以下是您可以将 Marketo 表单与您的网站集成的方式的一个不错的概述:http ://www.elixiter.com/marketo-landing-page-and-form-hosting-options/

如果您坚持以 iframe 方式进行操作,这是我将查询字符串参数传递给嵌入式 iframe 的设置:

这是在http://yourdomain.com/my-marketo-page

<div class="lazy-iframe" data-src="//pages.yourdomain.com/MyMarketoPage.html" style="width: 960px; height: 1000px;">
</div>

在一些共享库中(但您可以将它放在同一页面上,并稍微简化一下):

<script>
$(function() {
  var $lazyIframe = $('.lazy-iframe');
  if ($lazyIframe.length) {
    var src = $lazyIframe.attr('data-src');
    if (src) {
      var $iframe = $('<iframe src="' + src + location.search + '"></iframe>');
      $iframe.attr({
        scrolling: 'no',
        frameborder: 0
      });
      $lazyIframe.replaceWith($iframe);
    }
  }
});
</script>

鉴于这pages.yourdomain.com是您CNAME的 Marketo 域。

在我的电子邮件中,我只是链接到http://yourdomain.com/my-marketo-page,Marketo 会自动mkt_tok将该电子邮件收件人的 添加到该 URL 的末尾(成为http://yourdomain.com/my-marketo-page?mkt_tok=BLAHBLAHBLAH)。然后使用 URL 和附加的所有参数构造 iframe data-src,并且没有滚动或边框(由您决定)。

于 2014-07-31T18:57:36.553 回答