Is there any way to attach a javascript code to websites user visits ?
Not by RouterOS.
How to do this ? https://www.youtube.com/watch?v=lxsBE7V17_A What are the steps that i should follow in mikrotik.
You wouldn’t be able to do this with MikroTik. This type of injection only works on http enabled websites. More and more sites are now using https so it wouldn’t work anyways.