Yes, but the insecure part is not suitable for Javascript. For example, you can use the measurement protocol to collect data for one account. Here you can see many people in the same community who have understudies with this (and it's quiet, just decide). https://stackoverflow.com/search?q=spam+google+analytics
All of these measurement systems use HTTP calls to populate the data in your "database." If you can build the right call, you can spam everyone everywhere (but donβt do it, not evil).
https://developers.google.com/analytics/devguides/collection/protocol/v1/?hl=es-419
This Google Analytics page explains what a protocol dimension is, Javascript only works as a framework for creating and submitting hits.
https://developers.google.com/analytics/devguides/collection/protocol/v1/?hl=es-419
But not all is lost. For example, if you try to do this in your browser with this code, the limit for Google Analytics FrameWork will be 1 call per second and 150 per session (or cookie value). Yes, it is not difficult to overcome this barrier, but after that other barriers will come.
So, if you use the Javascript framework, it is safe. Now imagine that you are doing the same with python by sending HTTP to a Google Analytics server. It is possible, but: So, here are two important points.
Google Analytics has an active "firewall" to detect spammers and block them. (How and when they do it not publicly), but in my case I see much less spammer that several years ago.
There are also some good practices to avoid this. For example, save only domains under the white list by creating a filter that allows only traffic from your domain https://support.google.com/analytics/answer/1033162?hl=en
It is also very useful to protect e-commerce by using a filter to include only data from a particular store or with a specific parameter such as brand == my brand or CustomDimension == true. Exclude transactions with products over $ 1,000 (check your limits and apply proactive filters). This whole barrier made the complex break.
If you do this, you will protect your domain a lot (because it is too difficult to know the UA + Domain Valid combination when you create a robot), but you know that the whole system can be damaged. In my experience, I see only 2 or 3 cases of damage from a spammer or people who want to do harm, and in this case it would be possible to prevent if I created a proactive filter. Usually spam only spam ads in your account, almost never want to harm you. Facebook, Piwik and other tools are more or less the same.