Execute a function when the entire page is displayed

Last action you can do…

add_action('shutdown', 'before_the_end_of_world');

function before_the_end_of_world() {
   die('I will miss you, wordpress');
}