Disable for homepage
-
Is it possible to exclude js files or deregister script for certain pages? It breaks my SEO..
Thanks
-
Hi @bulgariana ,
The solution I am using that allows the deferral of ShareThis.js and other scripts launched by ShareThis is to use WP Rocket WordPress optimization plugin, with the following settings enabled.
OPTIONS
- Minify JavaScript files > Checked (active) > Excluded JavaScript Files > sharethis.js
- Load JavaScript deferred > Checked (active)
THIRD PARTY SOLUTION
This is not a built-in solution from ShareThis but rather it uses the functionality of a third party optimization plugin, WP Rocket, to massively speedup your website by loading pages with JavaScript deferred until an action is taken by the user (click, scroll, tap).Any of these user actions then triggers all deferred JavaScripts to run after the page is loaded, as seen by Google Page Speed Insights (Core Web Vitals).
Basically this functionality bypasses ShareThis, stopping it from loading all the many, many processes and calls to external servers, until you want the script to run. The speed up effect is very significant for reducing load times.
(I would love if ShareThis could build an equivalent run script deferral ability into their plugin in the future)>
Combine this with WP Rocket’s other CSS speed increase abilities and I now have managed to get my two production websites mostly passing Core Web Vitals for mobile & desktop, admittedly after a lot of trial and error optimization work.
SUGGESTION
This is just a suggestion, understanding this it does not directly answer your question, within the ShareThis plugin. A third party workaround but I thought to mention it as a potential solution that is definitely working well.Aly
Hey there, @bulgariana
For the moment, it isn’t possible to exclude the Javascript files for certain pages, only the buttons per se. We will forward this request to our engineers though. We apologize for the inconvenience with your SEO.
Also, thank you @agreenstreet for suggesting a workaround, we appreciate you helping others here in the Support Forum!
Sure, it’s possible. I have removed by this commands:
wp_deregister_style( 'share-this-share-buttons-sticky' ); wp_deregister_script('share-this-share-buttons-mu');-
This reply was modified 4 years, 2 months ago by
Bulgariana.
Hey there, @bulgariana!
We actually don’t recommend that you dequeue our scripts since this can produce unwanted results on the share counts and/or button configuration and functionality, as well as data gathering. However, can you please tell us what aspect of your SEO are the buttons affecting? This way, we can document it and hopefully address it in an upcoming release.
If you want to continue this conversation by email, you can contact us at support@sharethis.com
-
This reply was modified 4 years, 1 month ago by
ShareThis.
Hi @sharethis ,
Though the question was asked to @bulgariana I wished to contribute our SEO reasons for delaying the execution of ShareThis scripts using the third party WP Rocket optimizer plugin.
The biggest issue is Google Core Web Vitals.
The waterfall with all unncessary scripts delayed from firing until a mouse, tap or scroll action fires them allows our site to get a passing score with Core Web Vitals.
If ShareThis is allowed to fire its script as normal and make multiple calls to the needed outside servers for tracking and counts, this considerabley increases the page size (weight), the number of requests and the time of response as measured by Core Web Vitals.
The speed gain benefit by delaying ShareThis from firing until the page is loaded and interacted with is dramatic. We love the plugin just need to control when it fires to get good grades from Google. If fail on Core Web Vitals your page rank is negatively affected.
Repectfully offered as our reasons for delaying ShareThis script from immediately activating.
Aly
Ok @agreenstreet, thank you for sharing this with us.
We have sent this Feature Request to our engineers already, it would be something like the ability to “Control when the ShareThis scripts get triggered.”, right?We are gratified you are enjoying the ShareThis Tools too, we at ShareThis are in a constant state of evolution and self-improvement, most of which would not be possible without the valuable input from users like you.
Sincerely,
ShareThis Technical Support team.
The topic ‘Disable for homepage’ is closed to new replies.