Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook tracking pixel image is converted to amp-img instead of amp-pixel #6059

Closed
westonruter opened this issue Apr 8, 2021 · 1 comment · Fixed by #6965
Closed

Facebook tracking pixel image is converted to amp-img instead of amp-pixel #6059

westonruter opened this issue Apr 8, 2021 · 1 comment · Fixed by #6965
Labels
Bug Something isn't working Changelogged Whether the issue/PR has been added to release notes. Good First Issue Sanitizers
Milestone

Comments

@westonruter
Copy link
Member

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&amp;ev=PageView&amp;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&amp;ev=PageView&amp;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.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

@westonruter westonruter added Bug Something isn't working Sanitizers labels Apr 8, 2021
@westonruter westonruter changed the title Facebook tracking pixel image is converted to amp-img instead of amp-pixel Facebook tracking pixel image is converted to amp-img instead of amp-pixel Jun 8, 2021
@westonruter westonruter added this to the v2.2.2 milestone Feb 9, 2022
@westonruter westonruter modified the milestones: v2.2.2, v2.2.3 Mar 3, 2022
@westonruter westonruter modified the milestones: v2.2.3, v2.2.2 Mar 30, 2022
@westonruter
Copy link
Member Author

QA Passed

I added a Custom HTML block that contained the following:

<!-- Facebook Pixel Code -->
<noscript>
<img
	height="1"
	width="1"
	style="display:none"
	alt="fbpx"
	src="https://www.facebook.com/tr?id=abc123&ev=PageView&noscript=1"
/>
</noscript>
<!-- End Facebook Pixel Code -->

On an AMP page, it came out as expected:

<amp-pixel src="https://www.facebook.com/tr?id=abc123&amp;ev=PageView&amp;noscript=1" layout="nodisplay" class="i-amphtml-layout-nodisplay" hidden="hidden" i-amphtml-layout="nodisplay"></amp-pixel>

@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Changelogged Whether the issue/PR has been added to release notes. Good First Issue Sanitizers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants