Closed
Description
Bug Description
On an AMP-first site I ran across the following amp-img
:
<!--noscript-->
<amp-img height="1" width="1" alt="fbpx" src="https://www.facebook.com/tr?id=413752866132374&ev=PageView&noscript=1" class="amp-wp-enforced-sizes amp-wp-6a19fc1 i-amphtml-layout-intrinsic i-amphtml-layout-size-defined" layout="intrinsic" data-amp-original-style="display:inline-block" i-amphtml-layout="intrinsic">
<i-amphtml-sizer class="i-amphtml-sizer">
<img alt="" aria-hidden="true" class="i-amphtml-intrinsic-sizer" role="presentation" src="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzEnIHdpZHRoPScxJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZlcnNpb249JzEuMScvPg==">
</i-amphtml-sizer>
<noscript>
<img height="1" width="1" alt="fbpx" src="https://www.facebook.com/tr?id=413752866132374&ev=PageView&noscript=1" data-amp-original-style="display:none" class="amp-wp-cb45893">
</noscript>
</amp-img>
<!--/noscript-->
The Facebook tracking pixel is getting served as an amp-img
instead of the more-appropriate amp-pixel
. I believe the underlying PHP code where this is coming from is from the Facebook for WooCommerce plugin:
<!-- Facebook Pixel Code -->
<noscript>
<img
height="1"
width="1"
style="display:none"
alt="fbpx"
src="https://www.facebook.com/tr?id=<?php echo esc_attr( $pixel_id ); ?>&ev=PageView&noscript=1"
/>
</noscript>
<!-- End Facebook Pixel Code -->
Expected Behaviour
The AMP_Img_Sanitizer
should convert images with the https://www.facebook.com/tr
URL to amp-pixel
instead of amp-img
.
There are other tracking pixels out there in the wild which could be accounted for as well.
Do not alter or remove anything below. The following sections will be managed by moderators only.