URLパラメータをiframeに渡す
Pardotを使用したフォームをiframeで埋め込んで運用しております。
フォーム送信時のURLパラメータを取得したく、スクリプトを埋め込んでいるのですが、Pardotでutm_sourceが取得できていません。
Pardot側ではカスタム項目を追加し、utm_source で項目IDを設定、フォームに非表示で埋め込んでいます。
他に確認すべきことがSTUDIO側でありますでしょうか?
宜しくお願いいたします。
ーーーー
こちらを参考にしています:
アカウントエンゲージメント: URL パラメータをブラウザから iframe に渡す
https://help.salesforce.com/s/articleView?id=000384774&type=1
入力したスクリプトは下記のとおりです。
<noscript>
<iframe src="Pardotで作成したフォームURL" width="100%" height="950" type="text/html" Frameborder="0" allowedTransparency="true" style="border: 0"></iframe>
</noscript>
<script type="text/javascript">
var form = 'Pardotで作成したフォームURL';
var params = window.location.search;
var thisScript = document.scripts[document.scripts.length - 1];
var iframe = document.createElement('iframe');
iframe.setAttribute('src', form + params);
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', 950);
iframe.setAttribute('type', 'text/html');
iframe.setAttribute('frameborder', 0);
iframe.setAttribute('allowTransparency', 'true');
iframe.style.border = '0';
thisScript.parentElement.replaceChild(iframe, thisScript);
</script>スクリプトはiframe 埋込のすぐ後ろに入れています。