Hi Jeetu,
I assume all your tests are done locally, that is the web page you have embedded the tracker into is also open on the same machine.
When you initializing the JavaScript tracker you have to specify its address including the port number if different from 80.
window.snowplow('newTracker', 'stream-collector', '{{MY-COLLECTOR-URI}}', { // Initialise a tracker
appId: '{{MY-SITE-ID}}',
});
In your case replace
{{MY-COLLECTOR-URI}} with
localhost. Obviously, it's not going to work if accessed remotely, in which case the tracker should have a publicly accessible IP/domain.
Read more on integrating the JS tracker
here.
Regards,
Ihor