I have created a landing page in the webflow. Now, i want to track who so ever is filling the form coming from which url. As i am running fb and google ads, need to track the url whether a person is coming from fb ads or google ads. I have also add the UTM parameters in google and Fb ads. But is there any way to track them in Webflow.
Add hidden form field using custom code.
<input type="hidden" id="current-page" data-name="Current Page" />
Populate value of the hidden field with JS, Paste in Page Settings > Footer Code:
<script>
$('#current-page').val(location.href);
</script>
@kevin.fogarty Hey Kevin - I am curious if you ever figured this out. I did what @samliew suggested, but it does not always show the URL with the UTM in it. For example, if someone lands on my page with this UTM link
https://www.beaconbudget.com/?tab=fitness-tab#utm_source=Facebook&utm_medium=Fitness&utm_content=1
And then they click one of the navigation links, which scrolls down to a section, the URL becomes:
https://www.beaconbudget.com/?tab=fitness-tab#features
You said you figured it out, so I was just curious if your solution was able to store the URL that they landed on the page with and submit it with the form?
Thanks!
Hello @myonke,
Can’t really remember this one but I have been using this which works:
Add this code to your before </body>
tag:
<script>
{
document.getElementById('hiddenKey02').value = location.pathname;
}
</script>
Then add an embed code anywhere inside the form block and add this then make it hidden before you publish it:
<input type="hidden" class="sourceLogging" id="hiddenKey02" name="formUrl1" data-name="Page URL" value="">
Not sure exactly where I got it from.
Cheers
@kevin.fogarty You’re awesome - thank you for the quick reply!
No worries, my pleasure to help! It’s usually others having to help me!
I found the post BTW:
All the best
Superb its working but how to capture full URLs
Hey @Prakash_Amg
The full URL can be captured with a combination of what @samliew and @kevin.fogarty posted.
This worked for me as the code @samliew posted didn’t seem to capture CMS item pages (at least not when within a symbol form, but now this code does.
However i’m not sure if it captures the URL along with the UTM as @myonke was wanting as i’ve not got anything to test it on to see. But worked for my requirement!
Basically value = location.pathname
changed to value = location.href
<script>
{
document.getElementById('hiddenKey02').value = location.href;
}
</script>