It's definitely possible to paste that into one of the FoxyCart templates. Where it needs to go though is the real question. Should that conversion only be noted after a successful order? If so, it should go on the receipt page, and probably within the ^^receipt_only_begin^^ and ^^receipt_only_end^^ tags. For more information on those tags, see http://wiki.foxycart.com/static/redirect/receipt
If it just needs to run on an add to cart, you can just chuck that in your cart template. Both templates can be accessed from the FoxyCart administration.