Kenny - to determine where the issue may lie, I decided to revert to your original, simpler script. But even that's not working. Here is the script:
<script>
var myReferrer = (window.location != window.parent.location) ? document.referrer: document.location;
MktoForms2.whenReady(function(form){
form.setValues({"Avanade_Referral_URL":myReferrer});
}
</script>
For the hidden form field, I defined it as follows - is this correct?
And finally, when viewing the source code of the landing page, the script appears after the form. Does this make a difference?
Thanks!