Tracking referral ID for registered user

Tracking referral ID for registered user in WordPress

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.

testme-form

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
});

script-on-page

Test

https://fucan.org/testme?ref=tony1

testme-form-page

Result

result

2,062 total views, 20 views today

Author: Albert

Leave a Reply