Conversion tracking code immediately after body tag? I'm fairly new to Drupal, so bare with me. I need to add some tracking code immediately after the body tag on the checkout complete page. I'm guessing I need to add it to the html.tpl.php or $page_top variables or maybe a checkout pane. My question is:


Which way is the best way to do it?
If I need to add it in the html.tpl.php, how would I do that for just the checkout complete page?
If I need to add it in the $page_top variable for only the checkout complete page, how would I do that?
If I need to do it in a checkout pane, how would I keeping in mind is needs to be immediately after the body tag?


Using the Drupal Commerce module.
You can do this in template.php by using theme_preprocess_html()

function mytheme_preprocess_html(&amp;$vars) {
  $arg = arg();
  $vars['checkout_tracking_script'] = '';
  if (count($arg) == 3 &amp;&amp; $arg[0] == 'checkout' &amp;&amp; $arg[1] == 'complete' &amp;&amp; is_numeric($arg[2])) {
    $vars['checkout_tracking_script'] = '&lt;script&gt;myScript&lt;/script&gt;';
  }
}


Then in your html.tpl.php you can print your script like this.

&lt;?php if ($checkout_tracking_script): ?&gt;
  &lt;?php print $checkout_tracking_script; ?&gt;
&lt;?php endif ?&gt;