Load third party js on user interaction

Viewed 259

I have a WordPress site which has some external js files like recaptcha, gtm script, etc which are affecting my speed. I can't make it load after page load from my end as these files are coming from external source.

Is there any way to prevent loading these files and load on user interaction. If it was on my end I can use setTimeout to delay it. Basically I want to prevent it loading initially and load it one user interaction.

1 Answers

You can also use plugin like flying script, nitropack or wprocket to achieve this.

Related