For example, web application monitoring services like New Relic RUM or Bucky use JavaScript to collect data on a user's session and eventually send that data back to an endpoint. For New Relic, the data is sent to an endpoint like "http://bam.nr-data.net" with a great deal of parameters. With Bucky a similar payload is sent to an endpoint of your choosing.
How do these services prevent malicious users from abusing those endpoints? Couldn't a user easily mess with the JavaScript to send junk data? And, with a little more work, might they be able to send many payloads of that junk data, polluting the data these services are meant to collect?
I'm not a front-end developer myself (in DevOps), but from what I understand it is essentially impossible to completely prevent abuse of anything accessible in client-side code. Other answers here on SE and elsewhere suggest the same.
Are these services simply biting the bullet and hoping nobody abuses them? Do they rely on obscurity/obfuscation to minimize the chances? Or have they figured out a way to mitigate the implications of the client-accessible nature?