Bug | SEO Analyzer | Minifying 3rd-Party Files
-
Good Day,
Your plugin’s SEO Analyzer is suddenly flagging 3rd-party files that cannot be minimized.
In my case, the SEO Analyzer is flagging the following file (screenshot):
https://www.googleoptimize.com/optimize.jsPlease review and kindly provide a fix.
Thank you!
-
Update:
I temporarily fixed the above issue by disabling the Analytify (plugin) add-on titled, Google Optimize.
A permanent solution is still needed.
Thank you!
Hello @generosus,
?
Thank you for reaching out!
?
The SEO Analyzer flags any files that can’t be optimized, including 3rd-party scripts like Google Optimize. Unfortunately, we can’t minimize external files as they are hosted on other servers. These warnings can be safely ignored, as they don’t impact your site’s SEO performance.
?
Let us know if you need further assistance!Hi there!
As always, thanks for your prompt reply.
So, if neither you nor I can minimize 3rd-party files, why does Rank Math’s SEO Analyzer penalize our site (-x points)? Your SEO Analyzer needs to classify those instances as a “Warning” and not a “Failed Test.”
Please update your SEO Analyzer’s code to reflect that.
Thank you!
Hello @generosus,
We appreciate the feedback. However, the point of the minified test is to inform you that your site has non-minified JS and CSS files that can affect your site’s performance. That’s why we also include the external files. You can use the following filter to mark the external files as minified for our SEO Analyzer:add_filter('script_loader_tag', function($tag, $handle) {
if ('your-script-handle' === $handle) {
$tag = str_replace('script ', 'script data-is-minified="true" ', $tag);
}
return $tag;
}, 10, 2);Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hi there!
Yes, I clearly know and understand that. However:
- Your SEO Analyzer is flagging 3RD-PARTY JS files that cannot be minified and is also classifying the associated test result as a “failed test” and not a “warning.” All other analyzers – including PSI — are not flagging the above file, only yours. Please elevate this concern to your chief developer for a second review and fix.
- I enabled the data-handles for all JS files and, unfortunately, there is none assigned to the above 3RD-PARTY JS file. Specifically, this file: https://www.googleoptimize.com/optimize.js. If you know what the typically-assigned data-handle is for this file, I’ll give your filter a spin.
Thank you.
Hi @generosus,
Thank you so much for sharing your input.- Yes, it is logical to show it as a warning instead of a failed test. Our development team is currently discussing on this if this is something we can implement. Thank you for bringing this up.
- The script handler is added to the ID of the script. Eg:?
<script src="
https://rankmath.local/wp-content/plugins/seo-by-rank-math/assets/front/js/rank-math.js?ver=1.0.229
" id="rank-math-js"></script>
. Here the script handler is?rank-math
Hope that helps.
Hi there!
In response:
- Thank you. Looking forward to the change.
- Doesn’t that handler disable all JS files (not just 3rd-Party JS files) that may need to be minimized?
For tracking purposes, please leave this topic open until the above is resolved.
Thank you!
Hello @generosus,
?
The handler ID is specific to each script and won’t disable all JS files, just the ones you target. If you only want to affect a specific 3rd-party script like Google Optimize, you can apply the filter to that script’s unique handle.
?
Let us know how that goes.?
?
Looking forward to helping you.Hi there,
Yes, I know that.
You may not have understood what I stated before. To be more clear, there is no data-handle nor ID assigned to the Google Optimize JS file. Details: https://prnt.sc/TuJeoqKFg1VI
Based on what I shared, if you know what it is, please share it.
Again, your SEO Analyzer is penalizing websites for integrating 3rd-Party CSS and JS files that website administrators have no control over. Please fix that.
Thank you.
Hello @generosus,
?
Since the script has no ID assigned to it, you will have to ignore the SEO Analyzer test. We have shared your feedback with the development team and will let you know if they decide to change the modification test.
?
Please do not hesitate to let us know if you need our assistance with anything else.
?
Thank you.As you suggested, since Rank Math’s SEO Analyzer is not reliable, it will be ignored until this topic — and other issues I presented about your SEO Analyzer — are resolved.
For tracking purposes, please do not close this topic ad “Resolved” until actually resolved.
Thank you.
Hello,
For our tracking purposes, we will have to mark it as resolved because we have noted down your feedback and now it will undergo our internal process to be implemented.
If you want, you can open a new ticket again in the future if you wish to get an update but we will be sure to update you nonetheless when there is an update with a fix.
Respectfully, I created the topic and it has not been resolved. When resolved, I will close it. Thank you for understanding.
Hello, @generosus,
To resolve this issue, please add the filter hook to apply the fix.
If your script doesn’t have a handle, as you mentioned, it suggests the script may not be correctly included on your WordPress site. Scripts need to be added using the
wp_enqueue_script
function in WordPress. This method registers the script with a unique handle, allowing it to be available for WordPress hooks and ensuring that our fix can work as expected.If the script hasn’t been enqueued properly, the fix may not apply. Please ensure your script is set up using WordPress best practices, as this is essential for achieving compatibility with our solution.
Let us know if you need further assistance, and we’ll be happy to help!
Thanks for that. I will look into this. In the meantime, you haven’t addressed what I mentioned before:
So, if neither you nor I can minimize 3rd-party files, why does Rank Math’s SEO Analyzer penalize our site (-x points)? Your SEO Analyzer needs to classify those instances as a “Warning” and not a “Failed Test.”
Also, when are you going to fix your SEO Analyzer to properly disregard Page Objects that are lazy loaded? I presented this a long time ago, and still, remains unresolved. You SEO Analyzer is the only one that does this.
So, until the above is properly addressed, I will continue to ignore your SEO Analyzer’s results and score.
Cheers.
- You must be logged in to reply to this topic.