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

Replace img with amp-pixel when dealing with Facebook tracking pixel #6965

Merged
merged 9 commits into from
Mar 9, 2022

Conversation

delawski
Copy link
Collaborator

@delawski delawski commented Mar 8, 2022

Summary

Fixes #6059

This PR changes the way the AMP_Img_Sanitizer works.

Whenever a Facebook tracking pixel is encountered, e.g.:

<img height="1" width="1" style="display:none" alt="fbpx" src="https://www.facebook.com/tr?id=123456789012345&ev=PageView&noscript=1" />

it is is replaced with a more suitable amp-pixel instead of generic amp-img.

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@delawski delawski added Bug Something isn't working Sanitizers labels Mar 8, 2022
@delawski delawski added this to the v2.2.2 milestone Mar 8, 2022
@delawski delawski self-assigned this Mar 8, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

Plugin builds for e40d370 are ready 🛎️!

if ( self::is_tracking_pixel_url( $node->getAttribute( Attribute::SRC ) ) ) {
$amp_pixel_node = AMP_DOM_Utils::create_node(
$this->dom,
'amp-pixel',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add use AmpProject\Extension; to the top and then here do:

Suggested change
'amp-pixel',
Extension::PIXEL,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Plus, we already have use AmpProject\Extension; at the top. This has been addressed in 0d66f37.

@delawski delawski requested a review from westonruter March 9, 2022 09:31
delawski and others added 3 commits March 9, 2022 10:54
…059-img-to-amp-pixel

* 'develop' of github.com:ampproject/amp-wp: (63 commits)
  Improve nav menu E2E tests by creating test menu before each test suite
  Bail out if there is no menu location or it is already selected
  Add E2E tests for Twenty Twenty-Two header nav menu block
  Test Twenty Twenty search modal on mobile breakpoint
  Bump dependabot/fetch-metadata from 1.1.1 to 1.3.0
  Improve strings to account for one or more issues
  Fix type check by passing explicit string as href prop
  Include SCSS files in the lint-staged config for stylelint
  Fix stylelint issue
  Rename 'allowed' to 'associated'
  Use named functions
  Add label for why the validation data is being shown
  Remove wrapping of site-scan-results__source-detail
  Bump lint-staged from 12.3.4 to 12.3.5
  Update perimssions for gutenberg-packages-update workflow
  Add approve step for auto-merge workflow
  Add notice step
  Move conditional from matrix job to its steps
  Only run PHP feature tests when php files have changed
  Only run phpunit tests if a PHP file has changed
  ...
@westonruter westonruter merged commit b188731 into develop Mar 9, 2022
@westonruter westonruter deleted the feature/6059-img-to-amp-pixel branch March 9, 2022 17:39
westonruter added a commit that referenced this pull request Mar 9, 2022
@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. Sanitizers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Facebook tracking pixel image is converted to amp-img instead of amp-pixel
2 participants