Howdy Smattiza,
There should be nothing preventing you from storing a users location in a cookie and keying off of that going forward. Do note that custom code is outside the scope of support for WP Engine.
Assuming you stored location data in a cookie, you would need to update your GeoIP implementation to first check the cookie and do something and then skip the GeoIP data. You may need to contact support to have a cache exclusion put in place for that cookie, so asking for a “cookie based caching exclusion”
Here’s some sudo code:
if (user sets preferred location) {
set cookie with that value
};
if (cookie present) {
Read cookie value and do something
} else {
read value from geoip and do something
};
Thank you for the fast response! So I have asked on a couple of occasions via LiveChat if I could get these exclusions (city and state values) but the tech support group tells me they cannot allow it. Is there some other method of requesting this?
Hi smattiza,
I’m not quite sure what exclusions you are requesting. I think that’s the disconnect here.
GeoIP is built with caching buckets to serve pages with geographic specificity, you want these even if you implement the cookie solution you mentioned here. So the only caching exclusion you need is the cookie caching exclusion. You can only setup caching buckets for one variable, I recommend having city caching buckets, as you want to cache at the smallest unit of measure you use.
Ask support to add a cookie caching exclusion for the specific name of the cookie you are setting. You only want to serve the uncached page if the cookie is set, and you only want to set that cookie if a user explicitly sets a preferred location. Otherwise you are essentially never caching a page, which won’t be good for page performance.
Thank you. Everything you said makes sense and I did ask for the specific cookie name exclusion and was granted it. I appreciate your help and clarity!
Happy to help! Glad we got you taken care of! I’m marking this as resolved. Thanks for using WP Engine!