How does google analytics collect its data?

后端 未结 8 883
夕颜
夕颜 2020-12-12 19:33

Yes, I know you have to embed the google analytics javascript into your page.

But how is the collected information submitted to the google analytics server?

相关标签:
8条回答
  • 2020-12-12 20:25

    To expand on other very good answers, Google does provide an API to track async "virtual pageviews" which are reported by website authors themselves in their scripts to Google.

    _gaq.push(['_trackPageview', 'my_unique_action']);
    

    They provide it so it is possible to track actions that are not part of regular page views and http requests.

    Async tracking guide: http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html#Syntax

    0 讨论(0)
  • 2020-12-12 20:31

    Without looking at the code, I assume their data is collected from the HTTP headers they receive in the asynchronous request.

    Remember that most browsers send data such as OS, platform, browser, version, locale, etc... Also they do have the IP so they can guesstimate your location. And I assume they have some sort of clever algorithm to decide whether you are a unique visitor or not.

    Time on the site is probably calculated by using an onUnload() event.

    0 讨论(0)
提交回复
热议问题