Google Analytics cookies vs subdomain for static content

后端 未结 3 1870
礼貌的吻别
礼貌的吻别 2021-01-02 05:10

I have a website on www.example.com and use Google Analytics. I\'ve also set up static.example.com which serves all static content.

The problem is that the default b

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 05:55

    For anyone loading the Google Analytics javascript async (the recommended way according to Google) the syntax looks like this:

    _gaq.push(['_setDomainName', 'www.allinpoker.se']);
    

    This line should be before _trackPageview since it's configuring the cookies. You could find more info on developers.google.com.

    I also recommend setting up a permanent redirect on (in my case) allinpoker.se to www.allinpoker.se since you only want the tracking on the www sub domain.

提交回复
热议问题