Hey @SebastianTh,
If it’s available on the page, you will have to write a small JS script that would capture the required value and fill in your hidden fields.
It really depends on the particulars and what you are trying to record.
Best,
Hristian
I wanted to track the Lead Source from our Forms which when filled out, would post these in Zoho so I could run reports on successful campaigns etc. I just created a Lead Source field in my Zoho Lead page, and then in Unbounce added a hidden field with the Value (name of Lead Source… such and such Landing page) and then mapped it in the Unbounce integration area. Easy peasy. That said I was unable to take it another level and and map the refferer (ie. Google Ad). That’s next on my list to figure out.
Good luck!
Hey,
Would a tool like Google Analytics help you out here? Implement GA on the site, setup the form submit as a goal and you’ll have the source/medium for every goal in GA.
If you really want to send that data via e.g. a hidden field with the form submit itself I guess you’ll have to use the ‘document.referrer’ within a local JavaScript and store the data. The ‘document.referrer’ will not make a difference between organic or paid traffic from e.g. Google, it will all seem to originate from ‘www.google.tld’. You could have logic within your JS that e.g. looks if there is a query string parameter of ‘gclid’ and if that’s the case you know it’s from a paid ad. Same goes with ‘utm_campaign’ parameters if needed.
BR,
Daniel
Okay folks I solved my issue in the meantime and thought I would share that with you:
The function retrieves the Information of GA Client ID from the cookie and passes it on into the Hidden Field. It does the same with the URL:
<script type="text/javascript">
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
document.addEventListener("DOMContentLoaded", function(event) {
var gclid = null;
var gclid_count = 0;
gclid_int = setInterval(function(){
gclid = getCookie('_ga');
if(gclid != null || gclid_count>50) {
document.getElementById("form_gclid").value = gclid; // Writing into the hidden field
clearInterval(gclid_int);
}
gclid_count++;
},100);
var domain = window.location.host + window.location.pathname;
document.getElementById("form_domain").value = domain;
});
</script>
You can either implement it via GTM or with the Script Manager in Unbounce.
Hi!
Thanks for such a workaround. However, I can make it work 😦
- What should I use on “Field name and ID” on the Unbounce field form settings?
- On the Javascript element, should I use “head” for “Placement”?
Thanks!
On the Javascript element, should I use “head” for “Placement”?
Hi there,
Just wanted to check if this would work with Google ads so we can tell what which google ad campaign it comes from?