{"id":7523,"date":"2018-04-23T11:15:13","date_gmt":"2018-04-23T16:15:13","guid":{"rendered":"https:\/\/wpengine.com\/support\/geotarget\/"},"modified":"2018-04-23T11:15:13","modified_gmt":"2018-04-23T16:15:13","slug":"geotarget","status":"publish","type":"support","link":"https:\/\/wpengine.com\/support\/geotarget\/","title":{"rendered":"Geographically Customized Content with GeoTarget"},"content":{"rendered":"<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\u2019s server cache. Page content is cached as separate objects for separate regions allowing your site to show customized content, while still maintaining <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/tips-improving-page-cacheability\/\">cacheability<\/a> and <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" 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\n\n<h2 id=\"toc-about-geotarget\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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-1.png\" alt=\"\" class=\"wp-image-6756\"><\/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<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\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\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<p><a name=\"enable\"><\/a><\/p>\n\n\n\n\n\n<h2 id=\"toc-enable-geotarget\" 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 id=\"toc-purchase-geotarget-product-extension\" 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 Account Manager to purchase the product extension<\/p>\n\n\n\n<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-1\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\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\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<h3 id=\"toc-add-wp-engine-geotarget-plugin\" 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\u2019s 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-6757\"><\/figure>\n\n\n\n<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-2\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\n<p><a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/wordpress.org\/plugins\/wpengine-geoip\/\" target=\"_blank\" rel=\"noreferrer noopener\">The GeoTarget plugin can also be found here<\/a>.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<h3 id=\"toc-enable-a-geotarget-profile\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/wp-engine-scope-of-support\/#toc-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 \u201cbuckets\u201d. Use the most specific bucket. For example, if you need \u201ccountry\u201d &amp; \u201ccity\u201d, choose \u201ccity\u201d.<\/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\n\n<h2 id=\"toc-geotarget-shortcodes\" 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<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-3\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\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=\"#toc-php-environment-variables-for-geotarget\">GeoTarget PHP Environment variables<\/a> section.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<h3 id=\"toc-print-location\" 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<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-4\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\n<p>We don\u2019t advise using region outside of the USA or Canada. In the USA, \u201cregion\u201d will return <em>state<\/em>, in Canada \u201cregion\u201d will return <em>province<\/em>. Otherwise \u201cregion\u201d will simply return region number, which is not unique between countries.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\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 \u201cAustin, Texas, US\u201d 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 id=\"toc-print-conditional-content\" 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 id=\"toc-hide-content-from-specific-geographies\" 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\n\n<h2 id=\"toc-test-shortcodes\" 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<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-5\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\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\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\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\n\n<h2 id=\"toc-shortcode-best-practices\" 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\n\n<h2 id=\"toc-php-environment-variables-for-geotarget\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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\n\n<h2 id=\"toc-maxmind-country-continent-and-region-codes\" 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-1.png\" alt=\"\" class=\"wp-image-6758\"><\/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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 id=\"toc-postal-codes\" 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\u2019t recommend using this unless absolutely necessary.<\/p>\n\n\n\n<h3 id=\"toc-about-regions\" 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\u2026) (<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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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\n\n<h2 id=\"toc-additional-information\" 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 id=\"toc-maxmind-database\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 id=\"toc-redirecting-a-url-based-on-location\" 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\u2019s 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/web-rules-engine\/#toc-rewrite-rules\">Learn more about this feature here<\/a>.<\/p>\n\n\n\n<h3 id=\"toc-mobile-users\" class=\"wp-block-heading\"><span data-slate-fragment=\"JTdCJTIya2luZCUyMiUzQSUyMmRvY3VtZW50JTIyJTJDJTIyZGF0YSUyMiUzQSU3QiU3RCUyQyUyMm5vZGVzJTIyJTNBJTVCJTdCJTIya2luZCUyMiUzQSUyMmJsb2NrJTIyJTJDJTIydHlwZSUyMiUzQSUyMk5VTUJFUkVEX0xJU1QlMjIlMkMlMjJpc1Zva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QlN0QlNUQlN0Q=\">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\u2019s best practice to develop a website to be responsive. GeoTarget does work with responsive code.<\/p>\n\n\n\n<h3 id=\"toc-proxies-and-vpns\" 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 id=\"toc-performance-best-practices\" 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-1.png\" alt=\"\" class=\"wp-image-6758\"><\/figure>\n\n\n\n<h3 id=\"toc-geotarget-and-seo\" 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)\u2013so 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 id=\"toc-geotarget-and-gdpr\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 id=\"toc-wp-engine-scope-of-support\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" rel=\"noreferrer noopener\" href=\"https:\/\/www.maxmind.com\/download\/geoip\/misc\/region_codes.csv\" target=\"_blank\">Region Codes from UNEC<\/a><\/span><a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" 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\"> \u2013 See Developer\u2019s Guide for context on usage.<\/span><\/li>\n<\/ul>\n\n\n\n\n\n<h2 id=\"toc-limitations\" class=\"wp-block-heading\">Limitations<\/h2>\n\n\n\n<p><strong>Edge Full Page Cache<\/strong> \u2013 GeoTarget is not compatible with <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/cache\/#toc-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> \u2013 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 data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/nitropack-documentation\/#Using_Geotarget_with_Page_Speed_Boost\" target=\"_blank\" rel=\"noreferrer noopener\">Read more here<\/a>.<\/p>\n\n\n\n\n\n<p><strong>NEXT STEP: <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/personalization-user-segmentation-page-cache\/\">Personalize content with user segmentation and page cache<\/a><\/strong><\/p>","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":5937,"template":"","meta":{"_acf_changed":false,"mediapress_draft_name":"","_mediapress_is_draft_copy":false},"audience":[],"buyer-stage":[],"company-and-culture":[],"content-type":[],"location":[],"persona":[],"product":[88],"support-category":[133],"support-topic":[148],"topic":[95],"use-cases":[],"class_list":["post-7523","support","type-support","status-publish","has-post-thumbnail","hentry","product-geotarget","support-category-products-features","support-topic-cache","topic-development"],"acf":{"trending":false,"taxonomy_selector":{"":null,"taxonomy-audience":false,"taxonomy-buyer-stage":false,"taxonomy-company-and-culture":false,"taxonomy-content-type":false,"taxonomy-location":false,"taxonomy-persona":false,"taxonomy-product":[88],"taxonomy-support-topic":[148],"taxonomy-topic":[95],"taxonomy-use-cases":false}},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Configure GeoTarget for Content | WP Engine Support<\/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=\"Configure GeoTarget for Content | WP Engine Support\" \/>\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=\"WP Engine\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/04\/geotarget_order_of_operations_2-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1\" \/>\n\t<meta property=\"og:image:height\" content=\"1\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"16 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\":\"Configure GeoTarget for Content | WP Engine Support\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/geotarget\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/geotarget\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"datePublished\":\"2018-04-23T16:15:13+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\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"caption\":\"WP Engine\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/geotarget\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpengine.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Geographically Customized Content with GeoTarget\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#website\",\"url\":\"https:\\\/\\\/wpengine.com\\\/\",\"name\":\"WP Engine\u00ae\",\"description\":\"Managed Hosting for WordPress\",\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpengine.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#organization\",\"name\":\"WP Engine\",\"url\":\"https:\\\/\\\/wpengine.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/WPEngine_OGImage-1.webp\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/WPEngine_OGImage-1.webp\",\"width\":1200,\"height\":630,\"caption\":\"WP Engine\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/wpengine\\\/\",\"https:\\\/\\\/x.com\\\/wpengine\",\"https:\\\/\\\/www.instagram.com\\\/wpengine\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpengine\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCJeAEAxX69v24CUBZ0WBYSg\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Configure GeoTarget for Content | WP Engine Support","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":"Configure GeoTarget for Content | WP Engine Support","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":"WP Engine\u00ae","article_publisher":"https:\/\/www.facebook.com\/wpengine\/","og_image":[{"url":"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/04\/geotarget_order_of_operations_2-1.png","width":1,"height":1,"type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/support\/geotarget\/","url":"https:\/\/wpengine.com\/support\/geotarget\/","name":"Configure GeoTarget for Content | WP Engine Support","isPartOf":{"@id":"https:\/\/wpengine.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/support\/geotarget\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","datePublished":"2018-04-23T16:15:13+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\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","contentUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","caption":"WP Engine"},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/support\/geotarget\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/"},{"@type":"ListItem","position":2,"name":"Geographically Customized Content with GeoTarget"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/#website","url":"https:\/\/wpengine.com\/","name":"WP Engine\u00ae","description":"Managed Hosting for WordPress","publisher":{"@id":"https:\/\/wpengine.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wpengine.com\/#organization","name":"WP Engine","url":"https:\/\/wpengine.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/#\/schema\/logo\/image\/","url":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPEngine_OGImage-1.webp","contentUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPEngine_OGImage-1.webp","width":1200,"height":630,"caption":"WP Engine"},"image":{"@id":"https:\/\/wpengine.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/wpengine\/","https:\/\/x.com\/wpengine","https:\/\/www.instagram.com\/wpengine\/","https:\/\/www.linkedin.com\/company\/wpengine\/","https:\/\/www.youtube.com\/channel\/UCJeAEAxX69v24CUBZ0WBYSg"]}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support\/7523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/types\/support"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/media\/5937"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/media?parent=7523"}],"wp:term":[{"taxonomy":"audience","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/audience?post=7523"},{"taxonomy":"buyer-stage","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/buyer-stage?post=7523"},{"taxonomy":"company-and-culture","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/company-and-culture?post=7523"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/content-type?post=7523"},{"taxonomy":"location","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/location?post=7523"},{"taxonomy":"persona","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/persona?post=7523"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/product?post=7523"},{"taxonomy":"support-category","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support-category?post=7523"},{"taxonomy":"support-topic","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support-topic?post=7523"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/topic?post=7523"},{"taxonomy":"use-cases","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/use-cases?post=7523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}