{"id":37221,"date":"2018-04-23T11:15:13","date_gmt":"2018-04-23T16:15:13","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=support&#038;p=37221"},"modified":"2025-12-01T07:49:49","modified_gmt":"2025-12-01T13:49:49","slug":"geotarget","status":"publish","type":"support","link":"https:\/\/wpengine.com\/support\/geotarget\/","title":{"rendered":"Geographically Customized Content with GeoTarget"},"content":{"rendered":"\n<p>GeoTarget is a user segmentation system that allows users the ability to show different content or perform different actions based on the geolocation of their visitors. The GeoTarget system is unique in that it also plays nicely with WP Engine&#8217;s server cache. Page content is cached as separate objects for separate regions allowing your site to show customized content, while still maintaining <a href=\"https:\/\/wpengine.com\/support\/tips-improving-page-cacheability\/\">cacheability<\/a> and <a href=\"https:\/\/wpengine.com\/support\/how-to-brace-for-a-surge-of-traffic\/\">scalability<\/a>.<\/p>\n\n\n\n<p>GeoTarget is included with Premium plans and can be purchased for Shared plans by speaking with an Account Manager or the WP Engine Sales team.<\/p>\n\n\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">About GeoTarget<\/h2>\n\n\n\n<p>Users often face the struggle of finding a cacheable solution when implementing their geographically-customized content. For example, if a user wanted a Canadian phone number to show only for users in Canada and a US phone number to show for users in the United States, a developer would need to manually regenerate HTML for the page via PHP on every single page load, based on where the user is located.<\/p>\n\n\n\n<p>With GeoTarget, WP Engine\u2019s proprietary page caching system will store variations of the page for each geographic location in separate cache segments. Our GeoTarget system uses the GeoLite database from <a href=\"https:\/\/www.maxmind.com\/en\/geoip2-services-and-databases\" target=\"_blank\" rel=\"noopener noreferrer\">MaxMind<\/a> to determine where the user is from, and serves them cached version from their location. This allows your site to scale better with waves of traffic while still providing a custom experience.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/04\/geotarget_order_of_operations_2.png\" alt=\"\" class=\"wp-image-37223\"\/><\/figure>\n\n\n\n<p><span style=\"font-weight: 400\">With other integrations, you get GeoTarget from a Javascript library, but that loads only after the page has already been generated by WordPress\u00ae, and therefore you cannot make code-based modifications based on the geography.<sup><a href=\"#legal-disclaimer\">1<\/a><\/sup> There\u2019s also often a \u201cflash\u201d or other effect because the page is rendered before the Javascript gets a chance to do something differently.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Also, other page-caching systems are not flexible enough to be able to be tuned for specific GeoTarget use-cases, which means you generally have to disable page-caching, severely hampering your speed and scale. <\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Rather than creating your own implementation of rules based on a GeoIP database, WP Engine minimizes the needed technical effort from your team by managing the complex configuration of these rules, as well as the back-end settings to cache page variations separately. Enablement of GeoTarget in three simple steps unlocks the ability to segment pages by geography, so you can focus on building the content.<\/span><\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>GeoTarget is automatically included Premium WP Engine plans. It is available to be purchased as a product extension for all other plans by reach out to our Sales team.<\/p>\n<\/div><\/div>\n\n\n\n<p><a name=\"enable\"><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Enable GeoTarget<\/h2>\n\n\n\n<p>In this section we will outline the recommended steps to fully activate the functionality. After GeoTarget is enabled, users can create geographically-specific content and PHP functions using the proper GeoTarget variables.<\/p>\n\n\n\n<p><a name=\"purchase\"><\/a><\/p>\n\n\n\n<a name=\"Purchase_GeoTarget_Add-on\"><\/a>\n\n\n\n<h3 class=\"wp-block-heading\">Purchase GeoTarget Product Extension<\/h3>\n\n\n\n<p>Customers on Premium WP Engine plans will have GeoTarget included at no additional cost.<\/p>\n\n\n\n<p>If your plan is Lite, Startup, Growth, or Scale then simply reach out to your <a href=\"#sales\">Account Manager<\/a> to purchase the product extension<\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>You may use GeoTarget on any Site included in your WP Engine plan. As the product extension can be used on an unlimited number of environments within your plan, GeoTarget has a different price per plan tier.<\/p>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Add WP Engine GeoTarget Plugin<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Login to your website&#8217;s wp-admin dashboard area<\/li>\n\n\n\n<li>Click <strong>Plugins<\/strong> and select <strong>Add New<\/strong><\/li>\n\n\n\n<li>Search for <strong>WP Engine GeoTarget<\/strong><\/li>\n\n\n\n<li><strong>Install<\/strong> and <strong>Active<\/strong> the GeoTarget plugin<\/li>\n<\/ol>\n\n\n\n<p><span style=\"font-weight: 400\">Like any WordPress plugin, WP Engine will update the GeoTarget plugin from time to time. When an update is released, you will be able to update it in your WordPress Dashboard.<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/04\/install_geotarget_plugin.png\" alt=\"\" class=\"wp-image-37217\"\/><\/figure>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p><a href=\"https:\/\/wordpress.org\/plugins\/wpengine-geoip\/\" target=\"_blank\" rel=\"noreferrer noopener\">The GeoTarget plugin can also be found here<\/a>.<\/p>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Enable a GeoTarget Profile<\/h3>\n\n\n\n<p>Finally, you will need to contact our Support team to enable the GeoTarget <em>profile<\/em> for the environment(s) on which you wish to use the feature. This profile defines the caching bucket that GeoTarget can use on each site.<\/p>\n\n\n\n<p><b><a href=\"https:\/\/my.wpengine.com\/support\">Contact WP Engine Support<\/a> and provide the following information:<\/b><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Environment name(s) for GeoTarget<\/li>\n\n\n\n<li>Bucket to enable<\/li>\n\n\n\n<li><a href=\"https:\/\/wpengine.com\/support\/wp-engine-scope-of-support\/#Support_PIN\">Support PIN<\/a> for verification\n<ul class=\"wp-block-list\">\n<li>Your user must have access to all environments for which you are enabling GeoTarget. <\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>GeoTarget is able to sort visitors into specific geographic caching &#8220;buckets&#8221;. Use the most specific bucket. For example, if you need &#8220;country&#8221; &amp; &#8220;city&#8221;, choose &#8220;city&#8221;.<\/p>\n\n\n\n<p>The more specific and granular the bucket, the more segmented your cache will be. The more cache segments, the less effective cache is. This will impact performance as your traffic scales. Wider geographic buckets are best for both cacheability and scalability.<\/p>\n\n\n\n<p><strong>Available caching buckets:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Continent<\/li>\n\n\n\n<li>Country<\/li>\n\n\n\n<li>State\/Region<\/li>\n\n\n\n<li>City<\/li>\n<\/ul>\n\n\n\n<a name=\"shortcodes\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">GeoTarget Shortcodes<\/h2>\n\n\n\n<p>After enabling the GeoTarget system, you will be able to use the GeoTarget shortcodes in your website\u2019s Pages, Posts, and Widgets. GeoTarget Shortcodes are ideal to use when customizing different content to be displayed to your users around the globe.<\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>If you wish to perform PHP functions by using GeoTarget, such as redirects, pop-ups, or custom banner messages, skip down to the <a href=\"https:\/\/wpengine.com\/support\/geotarget\/#PHP_Environment_Variables_for_GeoTarget\">GeoTarget PHP Environment variables<\/a> section.<\/p>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Print location<\/h3>\n\n\n\n<p>Use the following GeoTarget location shortcodes to print the location of a user:<\/p>\n\n\n\n<p><code>[geoip-continent]<\/code><br><code>[geoip-country]<\/code><br><code>[geoip-region]<\/code><br><code>[geoip-city]<\/code><br><code>[geoip-postalcode]<\/code><br><code>[geoip-location]<\/code><\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>We don&#8217;t advise using region outside of the USA or Canada. In the USA, &#8220;region&#8221; will return <em>state<\/em>, in Canada &#8220;region&#8221; will return <em>province<\/em>. Otherwise &#8220;region&#8221; will simply return region number, which is not unique between countries.<\/p>\n<\/div><\/div>\n\n\n\n<p>To print out these variables, use the shortcodes in your Post, Page, or Widget as follows:<\/p>\n\n\n\n<p><code>Welcome to our website! Hope the weather is great in <strong>[geoip-city]<\/strong>, <strong>[geoip-region]<\/strong>, <strong>[geoip-country]<\/strong>.<\/code><\/p>\n\n\n\n<p>If I was visiting this website from &#8220;Austin, Texas, US&#8221; the output would be as follows:<\/p>\n\n\n\n<p><code>Welcome to our website! Hope the weather is great in Austin, TX, US.<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Print Conditional Content<\/h3>\n\n\n\n<p>You can use the <code>geoip-content<\/code> shortcode to display different content conditionally, based on the geographic location of your users. The basic format of the shortcode is as follows:<\/p>\n\n\n\n<p><code><strong>[geoip-content bucket=\"value\"]<\/strong>Your geographically-specific content here.<strong>[\/geoip-content]<\/strong><\/code><\/p>\n\n\n\n<p><strong>Your \u201cbucket\u201d can be any of the following values:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>continent<\/code><\/li>\n\n\n\n<li><code>city<\/code><\/li>\n\n\n\n<li><code>postalcode<\/code><\/li>\n\n\n\n<li><code>region<\/code><\/li>\n\n\n\n<li><code>country<\/code><\/li>\n<\/ul>\n\n\n\n<p>For example, if you wanted to say, \u201cGuten tag\u201d to users connecting from Germany, you could use the <code>geoip-content<\/code> shortcode like so:<\/p>\n\n\n\n<p><code><strong>[geoip-content country=\"DE\"]<\/strong>Guten tag!<strong>[\/geoip-content]<\/strong><\/code><\/p>\n\n\n\n<p>If you wanted to also say, \u201cBonjour\u201d to customers connecting from France on the same page, you could use the shortcode in this way:<\/p>\n\n\n\n<p><code><strong>[geoip-content country=\"DE\"]<\/strong>Guten tag!<strong>[\/geoip-content][geoip-content country=\"FR\"]<\/strong>Bonjour!<strong>[\/geoip-content]<\/strong><\/code><\/p>\n\n\n\n<p>You can use GeoTarget to inform only EU visitors about GDPR privacy regulation compliance for your site, while hiding this information from other users around the world.<\/p>\n\n\n\n<p>On your \u201cAbout Us\u201d page, you could display a message indicating the website\u2019s compliance by using the following code:<\/p>\n\n\n\n<p><code><strong>[geoip-content country=\"AT, BE, BG, HR, CY, CZ, DK, EE, FR, DE, FI, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE, GB\"]<\/strong> Heads up! We use cookies to ensure you get the best experience on our website. This website is also fully GDPR compliant. Head to http:\/\/mydomain.com\/privacy\/ to request a DPA if your organization requires one.<strong>[\/geoip-content]<\/strong><\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Hide Content from Specific Geographies<\/h3>\n\n\n\n<p>Use the \u201cnot-bucket\u201d syntax to HIDE content from specific geographies.<\/p>\n\n\n\n<p><strong>Your \u201cnot-bucket\u201d can be any of the following values:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>not-continent<\/code><\/li>\n\n\n\n<li><code>not-city<\/code><\/li>\n\n\n\n<li><code>not-region<\/code><\/li>\n\n\n\n<li><code>not-postalcode<\/code><\/li>\n\n\n\n<li><code>not-country<\/code><\/li>\n<\/ul>\n\n\n\n<p>For example, if you wanted to print, \u201cHello\u201d to all of the US, but only to Texas visitors print \u201cHowdy\u201d, use this logic:<\/p>\n\n\n\n<p><code><strong>[geoip-content country=\"US\" not-region=\"TX\"]<\/strong>Hello!<strong>[\/geoip-content][geoip-content region=\"TX\"]<\/strong>Howdy!<strong>[\/geoip-content]<\/strong><\/code><br><a name=\"test\"><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Test Shortcodes<\/h2>\n\n\n\n<p>Testing geographically customized content may present a challenge. For example, you could use a Virtual Private Network (VPN) to \u201cspoof\u201d a user\u2019s location. With GeoTarget, you can actually \u201cspoof\u201d locations much more easily just by adding arguments to the end of the URL you want to test.<\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>Spoofing locations in the following way will only work when testing the GeoTarget <em>shortcodes<\/em>, not when leveraging GeoTarget via <em>PHP code<\/em>.<\/p>\n<\/div><\/div>\n\n\n\n<p>To test how your homepage content may display to a user in Texas, use the following argument:<\/p>\n\n\n\n<p><code>yourdomain.com\/<strong>?geoip&amp;region=TX<\/strong><\/code><\/p>\n\n\n\n<p>To test how your homepage content may displayed to a user in the United States, use the following arguments:<\/p>\n\n\n\n<p><code>yourdomain.com\/<strong>?geoip&amp;country=US<\/strong><\/code><\/p>\n\n\n\n<p><strong>GeoTarget allows support for the following arguments:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>?geoip&amp;continent<\/code>=<\/li>\n\n\n\n<li><code>?geoip&amp;country=<\/code><\/li>\n\n\n\n<li><code>?geoip&amp;region=<\/code><\/li>\n\n\n\n<li><code>?geoip&amp;city=<\/code><\/li>\n\n\n\n<li><code>?geoip&amp;postalcode<\/code>=<\/li>\n<\/ul>\n\n\n\n<p>You can also combine the arguments by adding an ampersand <code>&amp;<\/code> in between values.<\/p>\n\n\n\n<p><code>yourdomain.com\/?<strong>geoip&amp;country=CA<\/strong>&amp;<strong>city=Toronto<\/strong>&amp;<strong>region=ON<\/strong><\/code><br><a name=\"bestpractices\"><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Shortcode Best Practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Apply shortcodes to multiple regions and separate using commas\n<ul class=\"wp-block-list\">\n<li><code><strong>[geoip-content country=\"US, CA, BR, MX\"]<\/strong>Americas content here<strong>[\/geoip-content]<\/strong><\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Exempt regions by narrowing specificity:\n<ul class=\"wp-block-list\">\n<li><code><strong>[geoip-content country=\"US\" not-region=\"TX, CA, OR\"]<\/strong>Content for everyone but Texas, California, Oregon<strong>[\/geoip-content]<\/strong><\/code><\/li>\n\n\n\n<li>OR <code><strong>[geoip-content region=\"TX\" not-city=\"Austin, Dallas\"]<\/strong>Content for everyone but Austin and Dallas<strong>[\/geoip-content]<\/strong><\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Don\u2019t get too granular or specific with your content:\n<ul class=\"wp-block-list\">\n<li><code><strong>[geoip-content city=\"Austin\"]<\/strong>Hi person from Austin!<strong>[\/geoip-content]<\/strong> <strong>[geoip-content city=\"Los Angeles\"]<\/strong>Hi person from Los Angeles!<strong>[\/geoip-content] [geoip-content city=\"New York\"]<\/strong>Hi person from New York!<strong>[\/geoip-content]<\/strong><\/code><\/li>\n\n\n\n<li>Instead, use the geolocation shortcodes as follows:\n<ul class=\"wp-block-list\">\n<li><code>\"Hi person from <strong>[geoip-city]<\/strong>!\"<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Don\u2019t make an exception to an exception:\n<ul class=\"wp-block-list\">\n<li><code><strong>[geoip-content continent=\"EU\" not-country=\"DE\" city=\"Berlin\"]<\/strong>Content to show to Europe, but exclude all of Germany except Berlin<strong>[\/geoip-content]<\/strong><\/code><\/li>\n\n\n\n<li>Instead, use two shortcodes in lieu of making an exception to an exception:\n<ul class=\"wp-block-list\">\n<li><code><strong>[geoip-content continent=\"EU\" not-country=\"DE\"]<\/strong>Content to show to Europe, but exclude all of Germany<strong>[\/geoip-content][geoip-content city=\"Berlin\"]<\/strong>Content to show to Berlin<strong>[\/geoip-content]<\/strong><\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Don\u2019t exempt a city that exists in two countries to which you are showing content:\n<ul class=\"wp-block-list\">\n<li><code><strong>[geoip-content country=\"US, FR\" not-city=\"Paris\"]<\/strong>Content to exempt from Paris, France<strong>[\/geoip-content]<\/strong><\/code><\/li>\n\n\n\n<li>The previous example would exempt Paris, TX and any other city in the US named \u201cParis.\u201d Instead, use two shortcodes to achieve the desired results:\n<ul class=\"wp-block-list\">\n<li><code><strong>[geoip-content country=\"FR\" not-city=\"Paris\"]<\/strong>Content to show to all of France except Paris<strong>[\/geoip-content][geoip-content country=\"US\"]<\/strong>Content to show to US<strong>[\/geoip-content]<\/strong><\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><a name=\"phpvariables\"><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Environment Variables for GeoTarget<\/h2>\n\n\n\n<p>If you need to create a PHP function to perform an action based on a GeoTarget variable, you will need to include the PHP environment variables to do so. Shortcodes used in the GeoTarget plugin may not be used in your PHP code. As such, you will need to retrieve the environment in your PHP code as follows:<\/p>\n\n\n\n<p><code>getenv( 'HTTP_GEOIP_COUNTRY_CODE' )<\/code><\/p>\n\n\n\n<p><strong>WP Engine\u2019s GeoTarget system supports the following environment variables:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Continent: <code>HTTP_GEOIP_CITY_CONTINENT_CODE<\/code><\/li>\n\n\n\n<li>Country: <code>HTTP_GEOIP_COUNTRY_CODE<\/code><\/li>\n\n\n\n<li>Region\/State: <code>HTTP_GEOIP_REGION<\/code><\/li>\n\n\n\n<li>City: <code>HTTP_GEOIP_CITY<\/code><\/li>\n\n\n\n<li>Zip\/Postal Code: <code>HTTP_GEOIP_POSTALCODE<\/code><\/li>\n<\/ul>\n\n\n\n<p>To simply print the values for an IP in the browser, the following can be loaded into a PHP file on your website:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\/** Loads the WordPress Environment and Template *\/\nrequire( dirname( FILE ) . '\/wp-load.php' );\n$test_geoip_country_Code = do_shortcode( '[<strong>geoip-country<\/strong>]' );\n$test_geoip_region = do_shortcode( '[<strong>geoip-region<\/strong>]' );\n$test_geoip_city = do_shortcode( '[<strong>geoip-city<\/strong>]' );\n$test_geoip_postalcode = do_shortcode( '[<strong>geoip-postalcode<\/strong>]' );\n$test_geoip_location = do_shortcode( '[<strong>geoip-location<\/strong>]' );\necho \"Country: \" . $<strong>test_geoip_country<\/strong> . \"&lt;br\/&gt;\";\necho \"Region: \" . $<strong>test_geoip_region<\/strong> . \"&lt;br\/&gt;\";\necho \"City: \" . $<strong>test_geoip_city<\/strong> . \"&lt;br\/&gt;\";\necho \"Postal Code:\" . $<strong>test_geoip_postalcode<\/strong> . \"&lt;br\/&gt;\";\necho \"Location: \" . $<strong>test_geoip_location<\/strong> . \"&lt;br\/&gt;\";<\/pre>\n\n\n\n<p>You can also use the PHP environment variables to pass GeoTarget data to JavaScript. For an example of how to pass this data to JavaScript, check out <a href=\"https:\/\/github.com\/nateinaction\/geotarget-js-example\" target=\"_blank\" rel=\"noopener noreferrer\">this example<\/a> where the developer uses the user\u2019s country to determine whether to display a GDPR popup box.<\/p>\n\n\n\n<p>GeoIP shortcodes can be called directly from PHP using the <code>do_shortcode()<\/code> function in WordPress:<\/p>\n\n\n\n<p><code>echo do_shortcode ( [<strong>geoip-city<\/strong>]);<br> echo do_shortcode ( \u2018[<strong>geoip-content<\/strong> <strong>country<\/strong>=\"US\"]\u2019 . \u2018Content just for US visitors\u2019 . \u2018[\/<strong>geoip-content<\/strong>]\u2019 );<\/code><\/p>\n\n\n\n<p><a name=\"codes\"><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">MaxMind Country, Continent, and Region Codes<\/h2>\n\n\n\n<p>GeoTarget is designed to be used with WP Engine\u2019s proprietary caching platform. As such, when you enable GeoTarget on your site, you have the ability to choose which GeoTarget variable (Country, Region\/State, City) you want to have its own separate cache on your site.<\/p>\n\n\n\n<p>For example, if you enable the Country caching bucket, visitors from Brazil, Mexico and Argentina will each have a cached version of the site built at the <em>country<\/em> level.<\/p>\n\n\n\n<p>While you may enable up to <strong>two<\/strong> caching buckets, it is important to note that some buckets work better with cache than others. If you segment your geographically-specific content too much, it can cause many versions of the page to be cached which is less effective for site speed and performance. For this reason, we recommend wider geographic buckets like Country, and Region\/State rather than City.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/04\/country_region_city_performance.png\" alt=\"\" class=\"wp-image-37222\"\/><\/figure>\n\n\n\n<p>The accepted country and continent codes used in GeoTarget come from MaxMind can be viewed at the following links:<\/p>\n\n\n\n<p><a href=\"http:\/\/www.geonames.org\/countries\/\" target=\"_blank\" rel=\"noreferrer noopener\">For a list of geographical codes, see Geonames.org.<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Postal Codes<\/h3>\n\n\n\n<p>This variable is only available in the US due to limitations with the location data GeoTarget uses. Currently, the estimation of accuracy for Postal Codes is less than <em data-ghq-card-content-type=\"ITALIC\">25% of GeoIP requests. <\/em>Therefore we don&#8217;t recommend using this unless absolutely necessary.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>About Regions<\/b><\/h3>\n\n\n\n<p>For \u201cregion,\u201d the MaxMind database will use the standardized two-letter postal state or province abbreviation for the US and Canada. Other global \u201cregion\u201d variables use the ISO-3166 standard, which include <em>numerical<\/em> region codes. These numerical region codes are often reused across multiple countries.<\/p>\n\n\n\n<p>There can be many regions with the same region number in different countries. Without specifying the country, the following code will display in <em>any<\/em> country with a region 23 (Tierra Del Fuego, Argentina; Qina, Egypt; and Offaly, Ireland, etc&#8230;) (<em>This is an example of what not to do<\/em>):<\/p>\n\n\n\n<p><code>[geoip-content region=\"23\"] Content only for Shanghai, China [\/geoip-content]<\/code><\/p>\n\n\n\n<p>This means you should include both the country code and the region number to ensure you get the intended region within that country (<em>This is the correct approach<\/em>):<\/p>\n\n\n\n<p><code>[geoip-content country=\"CN\" region=\"23\"] Content only for Shanghai, China [\/geoip-content]<\/code><\/p>\n\n\n\n<p><a href=\"https:\/\/www.maxmind.com\/download\/geoip\/misc\/region_codes.csv\" target=\"_blank\" rel=\"noreferrer noopener\">See the full list of region codes on MaxMind.<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Additional Information<\/h2>\n\n\n\n<p>When using GeoTarget there are some caveats to keep in mind. Due to the nature of GeoTarget there are some discrepancies users may experience that are outside of the control of WP Engine.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MaxMind Database<\/h3>\n\n\n\n<p>GeoTarget uses locations from the MaxMind GeoLite database. WP Engine does not control or update this database. For example, if unincorporated land became a city between the last time the MaxMind GeoLite database was updated and today, and a visitor from that city accessed your website, their city might not be interpreted correctly. If you need to submit a data correction request, you can use the <a href=\"https:\/\/www.maxmind.com\/en\/geoip-data-correction-request\">MaxMind correction request form<\/a> to do so.<\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Some locations in this database may not be accurate, or reflect up-to-date geopolitical boundaries. For example, an unincorporated place in a region might become its own city. If this happened after the current MaxMind GeoLite database was created, it may not return current data. This place may still display as unincorporated by the data printed by the WP Engine GeoTarget API. If you are experiencing an issue with incorrect locations, please <\/span><a href=\"https:\/\/www.maxmind.com\/en\/geoip-data-correction-request\" target=\"_blank\" rel=\"noreferrer noopener\"><span style=\"font-weight: 400\">submit a correction request to MaxMind<\/span><\/a><span style=\"font-weight: 400\"> directly.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Currently, WP Engine\u2019s GeoTarget database works best with IPv4. Support for IPv6 is expected in future releases.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Redirecting a URL Based on Location<\/h3>\n\n\n\n<p>In the past, redirecting a URL within your site based on the user&#8217;s location required GeoTarget. For example, redirecting all non-US users to a separate URL automatically when lading on your website. This is now possible more readily with the Web Rules Engine feature included on all plans. <a href=\"https:\/\/wpengine.com\/support\/web-rules-engine\/#Rewrite_Rules\">Learn more about this feature here<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span data-slate-fragment=\"JTdCJTIya2luZCUyMiUzQSUyMmRvY3VtZW50JTIyJTJDJTIyZGF0YSUyMiUzQSU3QiU3RCUyQyUyMm5vZGVzJTIyJTNBJTVCJTdCJTIya2luZCUyMiUzQSUyMmJsb2NrJTIyJTJDJTIydHlwZSUyMiUzQSUyMk5VTUJFUkVEX0xJU1QlMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlMjJzdGFydCUyMiUzQTElN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJibG9jayUyMiUyQyUyMnR5cGUlMjIlM0ElMjJOVU1CRVJFRF9MSVNUX0lURU0lMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJibG9jayUyMiUyQyUyMnR5cGUlMjIlM0ElMjJwYXJhZ3JhcGglMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJ0ZXh0JTIyJTJDJTIybGVhdmVzJTIyJTNBJTVCJTdCJTIya2luZCUyMiUzQSUyMmxlYWYlMjIlMkMlMjJ0ZXh0JTIyJTNBJTIyTW9iaWxlJTIwd2ViJTIwY29ubmVjdGlvbnMlMjIlMkMlMjJtYXJrcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJtYXJrJTIyJTJDJTIydHlwZSUyMiUzQSUyMkJPTEQlMjIlMkMlMjJkYXRhJTIyJTNBJTdCJTdEJTdEJTVEJTdEJTJDJTdCJTIya2luZCUyMiUzQSUyMmxlYWYlMjIlMkMlMjJ0ZXh0JTIyJTNBJTIyJTIwJUUyJTgwJTkzJTIwTFRFJTJGNEclMkYzRyUyRkVkZ2UlMjBjb25uZWN0aW9ucyUyMHJldHVybiUyMG51bGwlMjBHZW9UYXJnZXQlMjBkYXRhJTIwYXMlMjB0aGUlMjBpbmZvcm1hdGlvbiUyMHBhc3NlZCUyMGJ5JTIwY2VsbCUyMHRvd2VycyUyMGN1cnJlbnRseSUyMGRvbiVFMiU4MCU5OXQlMjBzdXBwb3J0JTIwR2VvbG9jYXRpb24uJTIwSWYlMjBhJTIwY3VzdG9tZXIlMjBpcyUyMGxvb2tpbmclMjB0byUyMHVzZSUyMGxvY2F0aW9uJTIwc2VydmljZXMlMkMlMjB3aGljaCUyMGRvZXMlMjBzdXBwb3J0JTIwbW9iaWxlJTIwY29ubmVjdGlvbnMlMkMlMjB5b3UlMjBtYXklMjB3YW50JTIwdG8lMjBwb2ludCUyMHRoZW0lMjB0byUyMEFuZHJvaWQlRTIlODAlOThzJTIwb3IlMjBpT1MlRTIlODAlOTlzJTIwbmF0aXZlJTIwZnVuY3Rpb25hbGl0eSUyMGRvY3VtZW50YXRpb24uJTIyJTJDJTIybWFya3MlMjIlM0ElNUIlNUQlN0QlNUQlN0QlNUQlN0QlNUQlN0QlNUQlN0QlNUQlN0Q=\">Mobile Users<\/span><\/h3>\n\n\n\n<p><span data-slate-fragment=\"JTdCJTIya2luZCUyMiUzQSUyMmRvY3VtZW50JTIyJTJDJTIyZGF0YSUyMiUzQSU3QiU3RCUyQyUyMm5vZGVzJTIyJTNBJTVCJTdCJTIya2luZCUyMiUzQSUyMmJsb2NrJTIyJTJDJTIydHlwZSUyMiUzQSUyMk5VTUJFUkVEX0xJU1QlMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlMjJzdGFydCUyMiUzQTElN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJibG9jayUyMiUyQyUyMnR5cGUlMjIlM0ElMjJOVU1CRVJFRF9MSVNUX0lURU0lMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJibG9jayUyMiUyQyUyMnR5cGUlMjIlM0ElMjJwYXJhZ3JhcGglMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJ0ZXh0JTIyJTJDJTIybGVhdmVzJTIyJTNBJTVCJTdCJTIya2luZCUyMiUzQSUyMmxlYWYlMjIlMkMlMjJ0ZXh0JTIyJTNBJTIyTW9iaWxlJTIwd2ViJTIwY29ubmVjdGlvbnMlMjIlMkMlMjJtYXJrcyUyMiUzQSU1QiU3QiUyMmtpbmQlMjIlM0ElMjJtYXJrJTIyJTJDJTIydHlwZSUyMiUzQSUyMkJPTEQlMjIlMkMlMjJkYXRhJTIyJTNBJTdCJTdEJTdEJTVEJTdEJTJDJTdCJTIya2luZCUyMiUzQSUyMmxlYWYlMjIlMkMlMjJ0ZXh0JTIyJTNBJTIyJTIwJUUyJTgwJTkzJTIwTFRFJTJGNEclMkYzRyUyRkVkZ2UlMjBjb25uZWN0aW9ucyUyMHJldHVybiUyMG51bGwlMjBHZW9UYXJnZXQlMjBkYXRhJTIwYXMlMjB0aGUlMjBpbmZvcm1hdGlvbiUyMHBhc3NlZCUyMGJ5JTIwY2VsbCUyMHRvd2VycyUyMGN1cnJlbnRseSUyMGRvbiVFMiU4MCU5OXQlMjBzdXBwb3J0JTIwR2VvbG9jYXRpb24uJTIwSWYlMjBhJTIwY3VzdG9tZXIlMjBpcyUyMGxvb2tpbmclMjB0byUyMHVzZSUyMGxvY2F0aW9uJTIwc2VydmljZXMlMkMlMjB3aGljaCUyMGRvZXMlMjBzdXBwb3J0JTIwbW9iaWxlJTIwY29ubmVjdGlvbnMlMkMlMjB5b3UlMjBtYXklMjB3YW50JTIwdG8lMjBwb2ludCUyMHRoZW0lMjB0byUyMEFuZHJvaWQlRTIlODAlOThzJTIwb3IlMjBpT1MlRTIlODAlOTlzJTIwbmF0aXZlJTIwZnVuY3Rpb25hbGl0eSUyMGRvY3VtZW50YXRpb24uJTIyJTJDJTIybWFya3MlMjIlM0ElNUIlNUQlN0QlNUQlN0QlNUQlN0QlNUQlN0QlNUQlN0QlNUQlN0Q=\">LTE\/4G\/3G\/Edge connections return null GeoTarget data as the information passed by cell towers currently don\u2019t support Geolocation. If you are looking to use location services, which do not support mobile connections, you may want to instead refer to Android\u2018s or iOS\u2019s native functionality documentation.<\/span><\/p>\n\n\n\n<p>It&#8217;s best practice to develop a website to be responsive. GeoTarget does work with responsive code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Proxies and VPNs<\/h3>\n\n\n\n<p>When customers access your website from an anonymous proxy or VPN, they may see content intended for a different audience as a result. Because a VPN or proxy service sends the request from a separate web server which may be located in another region, it\u2019s possible that someone from one region may be presented with content intended for another. For example, if you use a proxy that allows a user to browse from a British IP address, you may see content with the \u201cGB\u201d country code because that is where the IP address is located, even if you are truly in the US.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Performance Best Practices<\/h3>\n\n\n\n<p>GeoTarget is unique in that it allows you to create customized content for users that also plays nice with cache. Each version of the page content is stored in its own cache \u201cbucket\u201d to serve to other users in that same bucket group. However, if you display different content for lots of extremely specific regions, &nbsp;you may \u201cover-segment\u201d your cache. This makes your cache less effective. In order for your site to scale effectively, you may want to make content for fewer, broader regions.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/04\/country_region_city_performance.png\" alt=\"\" class=\"wp-image-37222\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">GeoTarget and SEO<\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">GeoTarget is primarily meant to improve and personalize user experiences. It should not be used to create geo-targeted landing pages intended to rank for specific geographic terms in search engines. GeoTargeted content is rendered server side. This means a bot\u2019s IP address location determines which content the bot will be served. For example, often times in the US, Googlebot triggers GeoTarget to serve content as if the would be user is based in the Bay Area of California (Google\u2019s HQ)&#8211;so it\u2019s important to not use GeoTarget content for geo-specific keyword targeting on landing pages you use to drive traffic from search engines.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">GeoTarget and GDPR<\/h3>\n\n\n\n<p>GeoTarget is a system which stores all location data client-side. This means WP Engine servers do not view or store data from your website\u2019s users. As such, the Data Protection Acts do not apply to the location data stored by WP Engine GeoTarget. <a href=\"https:\/\/support.maxmind.com\/hc\/en-us\/articles\/4408936792987-Overview-of-GDPR-and-Other-Privacy-Laws\" target=\"_blank\" rel=\"noreferrer noopener\">Read more about Location Data Regulations with GDPR<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">WP Engine Scope of Support<\/h3>\n\n\n\n<p>The WP Engine Support team is available to assist with your GeoTarget questions via Live Chat, 24\/7 with the following areas:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">Enabling GeoTarget<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">How GeoTarget works<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">How to test GeoTarget shortcodes<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400\">WP Engine Support is <em>not<\/em> able to help you create custom PHP code snippets for use with GeoTarget.<\/span><\/p>\n\n\n\n<p><strong>You can learn more about GeoTarget using the following resources:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/wordpress.org\/plugins\/wpengine-geoip\/\" target=\"_blank\"><span style=\"font-weight: 400\">GeoTarget plugin page<\/span><\/a><span style=\"font-weight: 400\"> at the WordPress plugin repository<\/span><\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/dev.maxmind.com\/geoip\/legacy\/codes\/iso3166\/\" target=\"_blank\"><span style=\"font-weight: 400\">Country Codes from MaxMind<\/span><\/a><\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/dev.maxmind.com\/geoip\/legacy\/codes\/country_continent\/\" target=\"_blank\"><span style=\"font-weight: 400\">Continent Codes from MaxMind<\/span><\/a><\/li>\n\n\n\n<li><span style=\"font-weight: 400\"><a rel=\"noreferrer noopener\" href=\"https:\/\/www.maxmind.com\/download\/geoip\/misc\/region_codes.csv\" target=\"_blank\">Region Codes from UNEC<\/a><\/span><a rel=\"noreferrer noopener\" href=\"https:\/\/www.maxmind.com\/download\/geoip\/misc\/region_codes.csv\" target=\"_blank\"><span style=\"font-weight: 400\">E<\/span><\/a><span style=\"font-weight: 400\"> &#8211; See Developer\u2019s Guide for context on usage.<\/span><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Limitations<\/h2>\n\n\n\n<p><strong>Edge Full Page Cache<\/strong> &#8211; GeoTarget is not compatible with <a href=\"https:\/\/wpengine.com\/support\/cache\/#Edge_Full_Page_Cache\" target=\"_blank\" rel=\"noreferrer noopener\">Edge Full Page Cache<\/a>. GeoTarget uses server-side logic which cannot be run from cached html files so Edge Full Page Cache must be disabled to use GeoTarget.<\/p>\n\n\n\n<p><strong>Page Speed Boost<\/strong> &#8211; GeoTarget does work with Page Speed Boost but you need to add dynamic content cookies in the PSB settings for cached content to be dynamically stored based on GeoTarget values. <a href=\"https:\/\/wpengine.com\/support\/page-speed-boost\/#Using_GeoTarget_with_Page_Speed_Boost\" target=\"_blank\" rel=\"noreferrer noopener\">Read more here<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><strong>NEXT STEP: <a href=\"https:\/\/wpengine.com\/support\/personalization-user-segmentation-page-cache\/\">Personalize content with user segmentation and page cache<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GeoTarget can present content to different users based on geographic location. Learn how to setup and use GeoTarget shortcodes and PHP variables.<\/p>\n","protected":false},"featured_media":126216,"template":"","support-categories":[14,3,6],"support-tag":[85],"class_list":["post-37221","support","type-support","status-publish","has-post-thumbnail","hentry","support-categories-account","support-categories-development","support-categories-platform","support-tag-geotarget"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Geographically Customized Content with GeoTarget - Support Center<\/title>\n<meta name=\"description\" content=\"Learn how to use GeoTarget to present content to different users based on location. How to use GeoTarget environment variables in PHP code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/support\/geotarget\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Geographically Customized Content with GeoTarget - Support Center\" \/>\n<meta property=\"og:description\" content=\"Learn how to use GeoTarget to present content to different users based on location. How to use GeoTarget environment variables in PHP code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/support\/geotarget\/\" \/>\n<meta property=\"og:site_name\" content=\"Support Center\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-01T13:49:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/support\/geotarget\/\",\"url\":\"https:\/\/wpengine.com\/support\/geotarget\/\",\"name\":\"Geographically Customized Content with GeoTarget - Support Center\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"datePublished\":\"2018-04-23T16:15:13+00:00\",\"dateModified\":\"2025-12-01T13:49:49+00:00\",\"description\":\"Learn how to use GeoTarget to present content to different users based on location. How to use GeoTarget environment variables in PHP code.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/support\/geotarget\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/support\/geotarget\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage\",\"url\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"contentUrl\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"width\":1200,\"height\":630,\"caption\":\"WP Engine\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/support\/geotarget\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Support Posts\",\"item\":\"https:\/\/wpengine.com\/support\/support\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Geographically Customized Content with GeoTarget\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/support\/#website\",\"url\":\"https:\/\/wpengine.com\/support\/\",\"name\":\"Support Center\",\"description\":\"WP Engine&#039;s Support Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Geographically Customized Content with GeoTarget - Support Center","description":"Learn how to use GeoTarget to present content to different users based on location. How to use GeoTarget environment variables in PHP code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpengine.com\/support\/geotarget\/","og_locale":"en_US","og_type":"article","og_title":"Geographically Customized Content with GeoTarget - Support Center","og_description":"Learn how to use GeoTarget to present content to different users based on location. How to use GeoTarget environment variables in PHP code.","og_url":"https:\/\/wpengine.com\/support\/geotarget\/","og_site_name":"Support Center","article_modified_time":"2025-12-01T13:49:49+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/support\/geotarget\/","url":"https:\/\/wpengine.com\/support\/geotarget\/","name":"Geographically Customized Content with GeoTarget - Support Center","isPartOf":{"@id":"https:\/\/wpengine.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","datePublished":"2018-04-23T16:15:13+00:00","dateModified":"2025-12-01T13:49:49+00:00","description":"Learn how to use GeoTarget to present content to different users based on location. How to use GeoTarget environment variables in PHP code.","breadcrumb":{"@id":"https:\/\/wpengine.com\/support\/geotarget\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/support\/geotarget\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage","url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","contentUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","width":1200,"height":630,"caption":"WP Engine"},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/support\/geotarget\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/support\/"},{"@type":"ListItem","position":2,"name":"Support Posts","item":"https:\/\/wpengine.com\/support\/support\/"},{"@type":"ListItem","position":3,"name":"Geographically Customized Content with GeoTarget"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/support\/#website","url":"https:\/\/wpengine.com\/support\/","name":"Support Center","description":"WP Engine&#039;s Support Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support\/37221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/types\/support"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media\/126216"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media?parent=37221"}],"wp:term":[{"taxonomy":"support-categories","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-categories?post=37221"},{"taxonomy":"support-tag","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-tag?post=37221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}