The above code will add the free product to every order. If you just want free products with other specific products use this:
PHP Code:
if ($productid == %ID%)
func_header_location($xcart_catalogs['customer']."/cart.php?mode=add&productid=%FREEID%&amount=1");
For example: If someone purchases productid 5 (and X-Box), it will automatically add productid=20 (a free game).
The bad thing about this code is that you will have to add these lines for every product that you want to have a freebee with. A better way would be to add a field to the database called free_products and then check for every added product is there is a freebee. But this way will work.