I want to send data like Google Analytics

Asked 1 years ago, Updated 1 years ago, 35 views

What should I do when I send data from a site like Google Analytics?

When I tried to do it with jQuery get or post, I thought there might be a cross-origin problem, but Analytics is also sending data using JavaScript.

In this case, how do you send the data?
Please let me know if there are any precautions as I cannot send user information poorly.

javascript jquery

2022-09-30 16:10

1 Answers

Google Analytics seems to be using JavaScript to gather unusual information about where the page is relatively clickable, but basic information such as ip address and UserAgent is basically available only on request.

For example, some devices do not work with Javascript, while the mobile version of Google Analytics also supports a non-Javascript.

This is accomplished by using the <img> tag.In other words, simply write <img src='http://hoge.com/a.gif'> in HTML, and your browser will send a request to hoge.com to retrieve the image.

Once requested, the server that accepts the request can obtain information about the request.

In other words, users have opened a single page, but behind the scenes they are accessing various sites (some bad people abuse it).

Cross-origin issues should be accessible without any problems if the server permits them.The exact opposite is true for site creators to have free access to server data and for server administrators to grant permission to site creators.


2022-09-30 16:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.