{"id":10331,"date":"2024-09-02T16:09:15","date_gmt":"2024-09-02T08:09:15","guid":{"rendered":"https:\/\/conditionalblocks.com\/docs\/geolocation\/"},"modified":"2025-05-01T12:13:06","modified_gmt":"2025-05-01T04:13:06","slug":"geolocation","status":"publish","type":"docs","link":"https:\/\/conditionalblocks.com\/docs\/geolocation\/","title":{"rendered":"Geolocation"},"content":{"rendered":"\n<p>The Geolocation features use an external API to correctly detect the user location. WordPress cannot accurately detect the location on its own, however we&#8217;ve made it simple by using services provided by <a href=\"https:\/\/ipinfo.io\">IPInfo.io<\/a>. <\/p>\n\n\n\n<p><a href=\"https:\/\/ipinfo.io\">https:\/\/ipinfo.io\/<\/a> has a generous free tier with <span style=\"text-decoration: underline;\">50,000<\/span> lookups per month.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to get started<\/h2>\n\n\n\n<p>Assuming you&#8217;ve already purchased and setup Conditional Blocks Pro on your WordPress site, then there&#8217;s only a few steps left before you can use one of the below Geolocation conditions.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Signup for your free API Key from <a href=\"https:\/\/ipinfo.io\">https:\/\/ipinfo.io<\/a><\/li>\n\n\n\n<li>Copy the API key<\/li>\n\n\n\n<li>Secure your API key usage by whitelisting your domain name &amp; server IP address.  <\/li>\n\n\n\n<li>Open a page in the WordPress Editor, then open Conditional Blocks and go the settings tab.<\/li>\n\n\n\n<li>Paste &amp; Verify that the API key is valid.<\/li>\n\n\n\n<li>Add the <strong>Geolocation &#8211; Country<\/strong> condition to a content block, and choose the specific country.<\/li>\n\n\n\n<li>That&#8217;s It! <\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"1110\" src=\"https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-08-28-at-18.44.28@2x-1200x1110.png\" alt=\"Screenshot form the IPinfo website\" class=\"wp-image-10360\" srcset=\"https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-08-28-at-18.44.28@2x-1200x1110.png 1200w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-08-28-at-18.44.28@2x-300x277.png 300w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-08-28-at-18.44.28@2x-768x710.png 768w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-08-28-at-18.44.28@2x-1536x1421.png 1536w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-08-28-at-18.44.28@2x-2048x1894.png 2048w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"958\" src=\"https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/secure-ipinfo-key-1200x958.png\" alt=\"\" class=\"wp-image-10624\" srcset=\"https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/secure-ipinfo-key-1200x958.png 1200w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/secure-ipinfo-key-300x240.png 300w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/secure-ipinfo-key-768x613.png 768w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/secure-ipinfo-key-1536x1227.png 1536w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/secure-ipinfo-key-2048x1635.png 2048w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1200\" height=\"660\" src=\"https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-09-06-at-11.00.31@2x-1200x660.png\" alt=\"Screenshot of where to insert the IPinfo API token in Conditional Blocks\" class=\"wp-image-10359\" style=\"width:1097px;height:auto\" srcset=\"https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-09-06-at-11.00.31@2x-1200x660.png 1200w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-09-06-at-11.00.31@2x-300x165.png 300w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-09-06-at-11.00.31@2x-768x422.png 768w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-09-06-at-11.00.31@2x-1536x844.png 1536w, https:\/\/conditionalblocks.com\/wp-content\/uploads\/2024\/09\/CleanShot-2024-09-06-at-11.00.31@2x-2048x1126.png 2048w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p><strong>Developing WordPress locally?<\/strong> <br>Local development site won&#8217;t detect your IP address correctly. You are WordPress site needs to be online for you to test geolocation features correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">How many API requests does the feature use?<\/h3>\n\n\n\n<p>The IPinfo.io API will only be triggered once on the pages where you the Geolocation conditions.<\/p>\n\n\n\n<p> In other words, 1 visitor = 1 API lookup on pages with Geolocation conditions.<\/p>\n\n\n\n<p>The API lookup will only happen once, even if you use multiple geolocation check on the same page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">My Token is verified but Geolocation conditions aren&#8217;t working<\/h3>\n\n\n\n<p>There could be two reasons why your blocks are not displaying as they should. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Firstly make sure you are using live website (not local on your computer).<\/li>\n\n\n\n<li>Double check your security settings in IpInfo.io include the domain of your website &amp; the server IP address. <\/li>\n\n\n\n<li><\/li>\n<\/ul>\n","protected":false},"featured_media":0,"parent":0,"menu_order":5,"comment_status":"open","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","nav_title":"","positive":"","negative":"","footnotes":""},"docs_category":[20],"class_list":["post-10331","docs","type-docs","status-publish","hentry","docs_category-features"],"blocksy_meta":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"docspress_archive":false,"1536x1536":false,"2048x2048":false,"sl-small":false,"sl-large":false},"uagb_author_info":{"display_name":"Morgan","author_link":"https:\/\/conditionalblocks.com\/author\/"},"uagb_comment_info":0,"uagb_excerpt":"The Geolocation features use an external API to correctly detect the user location. WordPress cannot accurately detect the location on its own, however we&#8217;ve made it simple by using services provided by IPInfo.io. https:\/\/ipinfo.io\/ has a generous free tier with 50,000 lookups per month. How to get started Assuming you&#8217;ve already purchased and setup Conditional&hellip;","_links":{"self":[{"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/docs\/10331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/comments?post=10331"}],"version-history":[{"count":11,"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/docs\/10331\/revisions"}],"predecessor-version":[{"id":10626,"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/docs\/10331\/revisions\/10626"}],"wp:attachment":[{"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/media?parent=10331"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/conditionalblocks.com\/wp-json\/wp\/v2\/docs_category?post=10331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}