You need to listen to the ConfigureFormatter
event and add a filter to the URL tag.
function addAmazonAssociateTag($url)
{
if (preg_match('(amazon)i', $url))
{
$url .= '?tag=123';
}
return $url;
}
$event->configurator->tags['url']->attributes['url']->filterChain->append('addAmazonAssociateTag');
That's the concept, aka the first 1% needed to write the actual plugin.