What solution can be used to insert a javascript in clients websites to track various statistics? [closed]

StackOverflow https://stackoverflow.com/questions/15222375

  •  18-03-2022
  •  | 
  •  

Вопрос

I want to insert a piece of javascript in the clients websites to track various statistics (like crazyegg, intercom.io), but traffic related.

I was thinking of using IronMQ but I don't know how to call it from Javascript directly and I am affraid that making a request to my server (3Gb Ram) from sites that have tens of thousands of visitors / days can cripple the server when making too many javascript requests in the same time.

Это было полезно?

Решение

You can call the IronMQ thru the HTTPS API.

See IronMQ REST/HTTPS API for more information.

Of course, you will need to provide Project ID and Token to JavaScript code. I suggest to encrypt Token before you place it into JS/HTML and decrypt on page load or before using the API.

Welcome Iron.io Live Chat even you will need more information.

Upd: For now it seems does not work. Because of Cross-Origin restrictions. But we're working on it, so, stay in touch.

Другие советы

You'll need to optimise as you go. If you find CPU is a problem, optimise for that. If you find memory is a problem, optimise for that, if bandwidth, etc etc etc. It all depends on

  • your requirements
  • your resources.

Optimisation is almost always the last step in the development process.

You might just have people include a 1x1 pixel image, you might have them include an iframe, or you might have them include a javascript file running off your server. Or you might have them include a javascript file on their server. More questions you need to ask yourself might be what information you want, what security issues are there, etc. If it's information for their purposes, then you don't need to worry about them forging it. Otherwise, you do.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top