This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Referral Source Tracker | |
Description: Tracks the original referral source of a lead and adds it to form submissions. | |
Version: 1.1 | |
Author: Mahmood Chowdhury | |
*/ | |
// Hook to initialize tracking on page load | |
add_action('wp', 'referral_source_tracker_init'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
// Check if the hidden field for referral source exists | |
var referralSourceField = $('input[name="referral_source"]'); | |
if (referralSourceField.length > 0) { | |
// Populate the hidden field with the referral source value | |
referralSourceField.val(referralSourceData.referralSource); | |
} | |
}); |