Community @ The Turning Gate

Support community for TTG plugins and products.

You are not logged in.

#1 2015-06-14 11:06:25

gaufde
Member
From: Ojai, CA
Registered: 2014-07-11
Posts: 63
Website

Cookie Law Info Over Multiple Sites

I just finished implementing the cookie law info plugin onto my sites via phplugins.php as discussed in this thread: http://community.theturninggate.net/top … -control/. Everything seems to be working perfectly, however, because I have three sites the user gets the banner three times, once on each site. Is there a way to make it so that if the user accepts the cookie on any one of my sites that they won't get the message again on my other sites?
Thanks,
Graceson

Offline

#2 2015-06-14 12:27:25

Matthew
Administrator
From: Seoul, South Korea
Registered: 2012-09-24
Posts: 4,877
Website

Re: Cookie Law Info Over Multiple Sites

I do not believe so. Browsers keep track of cookies based on URL, so the browser itself will not associate a cookie from my-first-domain.com with my-second-domain.com.


Campagna Pictures, http://campagnapictures.com
The Turning Gate, http://theturninggate.net

Offline

#3 2015-07-06 05:27:39

gaufde
Member
From: Ojai, CA
Registered: 2014-07-11
Posts: 63
Website

Re: Cookie Law Info Over Multiple Sites

In case anyone else is wondering, I did figure out a way to change this. I went to cookie-law-info>js>cookielawinfo.js and then edited the code a little. I looked up the js's setcookie function and found out that if you want the cookie to be set for a domain and all subdomains too the domain of the cookie should be set with a period in front of it. So, on line 11 I added my domain after path. Here is what that line looks like now for my site:

document.cookie = name+"="+value+expires+"; path=/; domain=.gracesonaufderheide.com";

This works extremely well because once the cookie is set once on any one of my sites it is also set for the other ones too. If you were going to integrate this into the plugin it would be nice to set up a box that people would put their domain in which would then insert the code for them. However, this wouldn't work if people were using completely different domains. I found this other solution for setting a cookie on completely different domains too: https://subinsb.com/set-same-cookie-on- … t-domains. I played with it for a while, but I couldn't get it to work without redirecting the visitor to a new page momentarily. It seems like there might be some way to implement this idea if you could get the hidden images to load so that the cookie is set, but it would be nice if the page didn't have to reload. Thats about all I have figured out about this. I hope this helps someone.
Graceson

Offline

Board footer

Powered by FluxBB