How to append to all urls in a string?

Posted by Echo on Stack Overflow See other posts from Stack Overflow or by Echo
Published on 2010-06-07T14:38:13Z Indexed on 2010/06/07 14:42 UTC
Read the original article Hit count: 152

Filed under:

How should I go about appending to the end of all urls in string of html that is about to be sent out as as email? I want to add the google analytics campaign tracking to it like this:
?utm_source=email&utm_medium=email&utm_campaign=product_notify

99% of the pages will not end in '.html' and some urls might already have things like ?sr=1 at the end of them.

© Stack Overflow or respective owner

Related posts about php