DEV Community

Java Script Tracking Script

Nikhil Sharma on July 22, 2022

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 call...
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.