Cloudflare geotargeting

I have been using GeotargetingWP plugin to geotarget on my website and it has been working ok up until now, when suddenly TTFB has taken a big hit. Never had a problem with it before but yeah…

So now I noticed Cloudflare has a geotargeting feature which means I might not need a plugin? Can I use this to geotarget certain sections on each page? For example, display one table on a page for UK visitors and another table for US visitors?


The user’s country code (I.e GB) will be sent in the CF-IPCountry header which you can use to decide which content to serve.

Thank you. How do you actually serve it though? With GeotargetingWP plugin it is very simple, I just add shortcodes like [geo UK]text here[/geo UK] or [geo exclude UK]text here[/geo exclude UK]


I’ve not used this plugin myself, but have a look at WP Cloudflare GeoIP Redirect – WordPress plugin | English (Canada). However, it may not be exactly what you’re looking for though.

Aside from that, you can use PHP to parse the CF-IPCountry header mentioned by @KianNH to get the visitor’s country code and do/show whatever you want based on that.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.