i'm making a adwords-like to my clients websites only, and i wan't to put the cookies to save the information to all domains (and not just domain mydomain.com
or subdomains .mydomain.com
, i mean all).
Code Sample:
setcookie('var_name', 'var_value', null, "/", '.mydomain.com' );
Can anybody h开发者_C百科elp me?
ThanksYou cannot set a cookie for a foreign domain. That would be a serious security flaw. Just think of how easy attacks like session fixation would be.
You can use an iframe to share and display the same information for a specific user on many pages. That's how Google Adsense and many other advertising solution work.
Most tracking systems of this type work by embedding an image or some other object into participating sites which is served from your domain. At this point you can issue cookies from the single domain that you do control, and track the users by watching the referral data on your web requests.
Since the object is served from your domain, there's no need for the cross-domain cookies that you're asking for, which is fortunate because they're not possible to do.
精彩评论