Very often, user referred others for registration for some purpose. How to track these information in WordPress.
Here's one solution.
Plugins
- Formidable
- Scripts n Styles
Steps
1. create a form (testme in this case) with hidden field. Get the Field Key value.
2. add script on Script n Styles:
header:
$ = jQuery;
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.search);
return (results !== null) ? results[1] || 0 : false;
}
footer:
$(document).ready(function(){
$("#field_5zpwa").val($.urlParam('ref')); // 5zpwa is the Field Key value for the hidden field
});
Test
https://fucan.org/testme?ref=tony1
Result
Comments