Google Analytics如何将数据发送回Google?

时间:2021-10-07 13:53:15

Perhaps I am missing something, but I am just learning javascript.

也许我错过了一些东西,但我只是在学习javascript。

My understanding of Single Origin Policy is that Google Analytics should not be able to send data back to Google.

我对单一来源政策的理解是,Google Analytics不应该能够将数据发送回Google。

How is it able to transmit send data to Google without violating the policy?

如何在不违反政策的情况下向Google发送数据?

2 个解决方案

#1


32  

From what I can tell, a webpage includes the JavaScript file from Google, then that script dynamically adds an image to the page (http://www.google-analytics.com/__utm.gif) which contains the information required for logging.

据我所知,网页包含来自Google的JavaScript文件,然后该脚本会动态地向页面添加图像(http://www.google-analytics.com/__utm.gif),其中包含记录所需的信息。

SOP does not apply to scripts, images or CSS files that are dynamically added to a page. This is why you much trust whatever JavaScript files you include in your webpages, as they will have complete control over the page.

SOP不适用于动态添加到页面的脚本,图像或CSS文件。这就是为什么您非常信任您在网页中包含的任何JavaScript文件,因为他们可以完全控制页面。

#2


4  

Ryan Doherty is correct. The Google Analytics javascript code draws a transparent 1px-by-1px gif image name __utm.gif on your page. When the request (which is located on Google's servers) for this image is made, information is appended as GET parameters. Google captures this data and begins processing it. Usually within 3-6 hours, you'll see the data show up in your GA reports.

Ryan Doherty是对的。 Google Analytics(分析)javascript代码会在您的网页上绘制透明的1px-by-1px gif图片名称__utm.gif。当发出此图像的请求(位于Google服务器上)时,信息将作为GET参数附加。 Google会捕获这些数据并开始处理。通常在3-6小时内,您会看到数据显示在GA报告中。

#1


32  

From what I can tell, a webpage includes the JavaScript file from Google, then that script dynamically adds an image to the page (http://www.google-analytics.com/__utm.gif) which contains the information required for logging.

据我所知,网页包含来自Google的JavaScript文件,然后该脚本会动态地向页面添加图像(http://www.google-analytics.com/__utm.gif),其中包含记录所需的信息。

SOP does not apply to scripts, images or CSS files that are dynamically added to a page. This is why you much trust whatever JavaScript files you include in your webpages, as they will have complete control over the page.

SOP不适用于动态添加到页面的脚本,图像或CSS文件。这就是为什么您非常信任您在网页中包含的任何JavaScript文件,因为他们可以完全控制页面。

#2


4  

Ryan Doherty is correct. The Google Analytics javascript code draws a transparent 1px-by-1px gif image name __utm.gif on your page. When the request (which is located on Google's servers) for this image is made, information is appended as GET parameters. Google captures this data and begins processing it. Usually within 3-6 hours, you'll see the data show up in your GA reports.

Ryan Doherty是对的。 Google Analytics(分析)javascript代码会在您的网页上绘制透明的1px-by-1px gif图片名称__utm.gif。当发出此图像的请求(位于Google服务器上)时,信息将作为GET参数附加。 Google会捕获这些数据并开始处理。通常在3-6小时内,您会看到数据显示在GA报告中。