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

Jetpack/Wordpress Pixel for AMP page is not added, after the last update #1722

Closed
bantilan opened this issue Dec 9, 2018 · 8 comments
Closed

Comments

@bantilan
Copy link
Contributor

bantilan commented Dec 9, 2018

Hi,

It seems the pixel for tracking the views for jetpack is not added on the latest update for AMP. when i check the google cache amp, there is no wordpress pixel added.

@dartiss
Copy link

dartiss commented Dec 10, 2018

This may explain what I'm seeing - Jetpack stats are not tracking AMP pages anymore

@bantilan
Copy link
Contributor Author

bantilan commented Dec 10, 2018

@dartiss , I temporarily fix it by adding this code in the templates/footer.php.. https://codefaq.org/web-development/how-to-fix-wordpress-pixel-stat-tracking-not-working-in-amp-pages/

@dartiss
Copy link

dartiss commented Dec 10, 2018

@westonruter
Copy link
Member

westonruter commented Dec 10, 2018

I can see what the problem is. The Jetpack_AMP_Support::jetpack_is_amp_request() method is defective.

A quick (untested) workaround until it is fixed is to add this to your plugin or theme:

add_filter( 'jetpack_is_amp_request', function() {
    return did_action( 'parse_query' ) && function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
} );

I'll open a PR in Jetpack with a permanent fix.

@bantilan
Copy link
Contributor Author

thanks @westonruter

@dartiss
Copy link

dartiss commented Dec 10, 2018

I've applied it to one of my sites and I'll let you know if it resolves the issue.

If this is applied to Jetpack will having this patch as well cause problems?

@westonruter
Copy link
Member

No, there won't be a conflict.

@westonruter
Copy link
Member

PR has been opened for Jetpack: Automattic/jetpack#10918

Please test and provide feedback there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants