This is re-reporting of the image tracking code issue reported in ticket #2642. Unfortunately, the issue in the "Image Tracker code" shown in the web interface is still present in Piwik version 1.6. Despite the fact that "&" is present in DisplayAlternativeTags.tpl.
Works for me - if you experience an error please post it here...
I didn't mean the API functions - that seems to be fine. I meant the "Piwik Image Tracker" as shown in Piwik web interface (or should I better call it "user interface"?) under "Settings" - "Websites" - "View Tracking code" - "Display Image Tracker code".
It seems that the "&" in the template gets converted to "&" in the web interface. (Just like, e.g., "<" gets converted to "<".) Is it possible that the leading "&" needs to be escaped, so that "&" is kept in the web interface? (I don't know much about PHP/HTML.)
Or maybe urlencode() or htmlspecialchars() or htmlentities() with "&" needs to be used?