I think you have to add this script in success.phtml
from checkout/success.phtml in this file you got $order
object and you get all information from this object like your transaction id,product information just like ex.
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$transactionid=$this->getOrderId()
foreach ($order->getItemsCollection() as $item)
{
$item->getData();
$proidcol[]=$item->getData('product_id');
$pronamecol[]=$item->getData('name');
$proqtycol[]=$item->getData('qty_ordered');
$productpricecol[]=$item->getPrice();
}
in this $pronamecol
you can get all product name array from order and then implement this in java-script code using for loop ,,I think you can easily do that