Get the referrer, paid/natural and keywords for the current visitor with Google Analytics

后端 未结 3 776
死守一世寂寞
死守一世寂寞 2020-12-02 22:00

Is it possible to get the following information about the current visitor using Google Analytics API with JavaScript?

  • Referrer site (\'Source\' in GA)
3条回答
  •  渐次进展
    2020-12-02 22:02

    You should be able to get it all from the cookies set by Google Analytics. They are stored as first party cookies so JavaScript running on a page will be able to read them. The number of visits can be obtained from the last part of the __utma cookie and the referrer can be taken from __utmz. The source is the utmcsr bit of __utmz while the medium comes from utmcmd and the keyword is utmctr.

提交回复
热议问题