<?php function phptemplate_preprocess_page(&$vars) { if(drupal_get_path_alias($_GET['q']) == 'cart/checkout/complete') { // Getting order id preg_match("^Your order number is (\d*).^", $vars['content'], $matches); $order_id = $matches[1]; $order = uc_order_load($order_id); $vars['closure'] .= '<img src="https://shareasale.com/sale.cfm?amount=' . $order->order_total . '&tracking=' . $order->order_id . '&transtype=sale&merchantID=XXXXXX" width="1" height="1">'; } } ?>