DEV Community

Nikhil Sharma
Nikhil Sharma

Posted on

Java Script Tracking Script

Hi to All Community,

I want to know that, what makes the java script tracking code light, so when a website owner inject that (in general we called third party js code).

What efforts i can do to make it more light js script, that won't the website performance as SEO. As normally the this issue covered in reduce the third party js execution time.

*Suggestions are highly Appreciated. *

Top comments (3)

Collapse
 
fkranenburg profile image
Ferry Kranenburg

Make sure to only include used code (tree shaking) in the final build and make sure you minimize it before putting it in production.

Collapse
 
imnikhilsharma profile image
Nikhil Sharma • Edited

Thanks ferry! also whenver a website owner use this tracking they said that this tracking code affacting their website load time. In that case what should i do.. what things i need to change in the code or just minifying the code will help this....

Collapse
 
fkranenburg profile image
Ferry Kranenburg

The website owner should always load external scripts with the 'async' tag. So it won't affect the load time but will be processed and downloaded a bit later, in another thread of cpu. This tag won't affect your code so it is completely safe. Both parties win.