简体   繁体   中英

setting cookie from subdomain that includes main domain for google analytics

Main site - www.example.com
App site - app.example.com

The cookie is created on app.example.com, but should also work for www.example.com.

setcookie("gacookie", time(), time()+31536000, '/');

Is this possible? What would be the code?

The cookie is being used to create a filter for GA that will exclude all current members of my application. The cookie is set the first time they log in. Both the main domain and the subdomain use the same GA tracking code.

Also, if another site that I visit has a cookie with the string "gacookie", will that effect the Google Analytics filter, or will it only ready cookies from the domain and subdomain it is tracking...

Here are more details on how to integrate tracking across sub/domains.

http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM