-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix AMP compatibility for Standard and Transitional mode (#181) #182
Conversation
Standard and Transitional mode use the "amp_analytics_entries" hook, Reader mode uses "amp_post_template_analytics". We only added a filter for the latter, so AMP compatibility was only available in Reader mode.
This works for me. 👍🏻 |
Great. Thanks for the quick feedback. I‘ll add a condition to remove the unnecessary scripts tomorrow (if nobody is faster), then we can rollout the fix. |
Scripts and inline JS get removed on pages served via AMP. While that's fine for Statify, because we do use a separate analytics hook, it raises warnings for invalid markup on every AMP page. We now detect AMP usage and skip embedding the script. Also the checks are updated to use the new amp_is_request() function introduced in AMP plugin 2.0 for future compatibility.
23fc7c2
to
a19a01a
Compare
I've added the necessary check within the An earlier check, e.g. not register |
Also the check in |
Commonly used methods "beacon" and "xhrpost" are enabled by default, but as Statify doesn't work with "image", i.e. GET requests, we now specify the supported methods explicitly again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Standard and Transitional mode use the
amp_analytics_entries
hook, Reader mode usesamp_post_template_analytics
.We only added a filter for the latter, so AMP compatibility was only available in Reader mode.