After creating invoice and shipment, it is necessary to add tracking information to shipment. Here is how to write a observer which will invoke as shipment save method is called and save tracking information programatically.
config.xml – under global -> events node
singleton
Namespace_Modulename_Model_Observer
salesOrderShipmentSaveBefore
Observer.php -> under Model directory of module
public function salesOrderShipmentSaveBefore($observer)
{
$shipment = $observer->getEvent()->getShipment();
$track = Mage::getModel(‘sales/order_shipment_track’)
->setNumber(‘824343454454’) //tracking number / awb number
->setCarrierCode(‘aramex’) //carrier code
->setTitle(‘Aramex’); //carrier title
$shipment->addTrack($track);
}