Amazon Affiliate Pixel Replacement REGEX

sisserou

Grand Guru
Joined
Sep 4, 2018
Messages
301
I know it is a bit of a stretch here asking this question. I really should be maybe on one of the coding forums, but I thought I would try this first since someone may have been through this already.

We have a huge site using the amazon affiliate program. Moving forward, we are not going to be using the amazon image pixel in the code because it slows down the site and when amazon's server has problems, it has in the past crashed various sites according to complaints I see. Our site, too.

I wanted to just do a simple search and replace - grabbing the
<img style="border: none !important; margin: 0px !important;" src="https://ir-na.amazon-adsystem.com/e/ir?t=TACKINGID-20&amp;l=li2&amp;o=1&amp;a=ASIN" alt="" width="1" height="1" border="0" />

But then I realized every string is different because of the tracking ID and ASIN.

I need to use REGEX format - in php to search and replace.

Problem is when I test the php in the regex tester (I've tried 2), it keeps flagging the forward slashes as not correct patterns. The forward slashes are not acceptable in the amazon URL.

Does anyone
 
To view the premium content in our affiliate marketing forum (including this awesome thread), you must first register and upgrade your account. Register today and become a part of our amazing community!
Top