Skip to content

Instantly share code, notes, and snippets.

View mahmoodchowdhury's full-sized avatar

Mahmood Chowdhury mahmoodchowdhury

View GitHub Profile
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);
}
});
<?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');