Best way to redirect a page after javascript tracking code has executed
You can do something like below:


Create a custom module, If not already created (read more).
In your custom module, define a custom callback using hook_menu, and add a page callback.
In page callback function simply 'echo "script file/code"'. This will prevent Drupal from rendering various template files in your callback. NOTE:* If you use return instead of echo, Drupal will start rendering template files.
In your .JS file/code, do required tracking and re-direct user to another page.


Sample Code:

MODULE_NAME.module

/**
 * Implements hook_menu().
 */
function [MODULE_NAME]_menu() {
  $items['custom_url'] = array(
    'title' =&gt; 'Test',
    'page callback' =&gt; '_[MODULE_NAME]_callback',
    // Check required access.
    'access callback' =&gt; TRUE,
  );

  return $items;
}

function _[MODULE_NAME]_callback() {
  $jquery = base_path() . 'misc/jquery.js';
  $script = drupal_get_path('module', 'MODULE_NAME') . '/[MODULE_NAME].js';
  echo '&lt;script src="' . $jquery . '"&gt;&lt;/script&gt;
    &lt;script src="' . $script . '"&gt;&lt;/script&gt;';
}


MODULE_NAME.js

(function() {
  $(document).ready(function() {
    // Do your tracking here.
    console.log("Test");
    window.location.href = "http://example.com";
  });
}(jQuery));




Edit :

No worries, if you've not created a module before, you can follow steps given in How to Make a Simple Module with a Form and Menu Link to try how it works. The documentation is regarding creating a module which will define a menu callback and form.

Here you can find a detailed guide regarding Creating custom modules.

The code snippet I've provided above includes all basic code as per your requirement, except the tracking code which you need to write inside MODULE_NAME.js file. See the comment saying // Do your tracking here.