Capture Custom UTM Params
Let's say you have a URL where you pass an Affiliate ID or other data you want to capture for example yourlandingpage.com?affiliate=608789
Using Widgets 2.0 api you can capture that data by altering your embed code with the following
window._wf = window._wf || []; _wf.push({ id: '7NFRrs95rdDru4v4h5uU', onReady: function(api) { var urlParams = new URLSearchParams(window.location.search); var affiliateID = urlParams.get('affiliate'); api.setField('affiliate', affiliateID); } });
How it looks all together (make sure your wf target and ids are from your account not from below
<script src="https://d3pw37i36t41cq.cloudfront.net/embed_v2.js" async></script> <div class="wf_target wf_target_LR8CxWVxZrxWpHna9GfT23rE"></div> <script> window._wf = window._wf || []; _wf.push({ id: '7NFRrs95rdDru4v4h5uU', onReady: function(api) { var urlParams = new URLSearchParams(window.location.search); var affiliateID = urlParams.get('affiliate'); api.setField('affiliate', affiliateID); } }); </script>