My first task in the Ad Tech world was to upgrade a PHP-spaghetti like tracking pixel. It was a fantastic piece of software that helped the company to save millions by answering one simple question: which ad is performing better?
Today it is obsolete. Most of the channels have their tracking pixel, like Facebook. You have tools like Mixpanel to track users activity or MMPs (Mobile Measurement Partners) like Kochava to track actions within mobile apps.
It doesn’t make sense to build your tracking pixel today (or even to use PHP?). Your incredibly talented developers should be working on something that is not available in the market (like real-time interaction management features).
Rule of thumb: if not available, build it. If available, buy it.