• The plugin works great, except the GeoIP Detection is not working, so it is not excluding continents, like North and South America that do not have to comply with GDPR. I have installed/activated the GeoIP Detection plugin and downloaded the GeoLite2-City database. I selected all continents other than Europe for exclusion; however I am based in the United States and I still get the consent message every time I visit my site.

    Am I missing anything in order to get the geo detection working?

Viewing 15 replies - 1 through 15 (of 53 total)
  • I have the same problem, i see always the cookie also after GeoIP plugin installation.
    Is it possible to have a solution? i need to show the cookie message only in EUROPE

    THANKS

    I am also having this issue. Pretty much the same situation as bulletpointdigital, when I test IP detection it is working for my location and shows the continent as “NA” but I still see the message.

    Would love a solution too.

    I had the same issue until I found out that in GeoIp Detection plugin there is an option under General Option > Add a country-specific CSS class to the <body>-Tag.

    You just need to check that option and detection will work.
    What cookie consent plugin does is to check if there is a location class in the body and based on that location class show and hide the cookie content.

    I think it would be great if author can mention this in installation. Btw I still has not read the installation instructions. ??

    Thanks @mafia99! That’s exactly what I needed. ??

    This suggested solution is not an acceptable solution. I have a quite lengthy message. checking “Add a country-specific CSS class to the <body>-Tag.” makes the message invisible but all empty space at the top remains (Hence the message seem to be there but text colours are set to blank so not visible. The annoying result is that you get a large blank space above your site and there is no way to get rid of that because the button to close the message is also hidden. A proper solution should also remove all the empty space to be like there was no cookie message.

    I have done the steps recommended including downloading, activating both plugins, updating to Maxmind GeoIP Lite City, General Option > Add a country-specific CSS class to the <body>-Tag, and selecting the excluded zones, but people in the US are still getting the popups. Any suggestions? When I have tested things, it is locating me fine, I am wondering if Cookie Consent is not firing on all cylinders to block the popup?!
    Thank you!

    @alwaysenthusiast You are right this is not a great solution. But I am sure little css can fix your issue.

    @claymade send me the url of your site. Maybe I can help you find the solution

    I actually have done this on 4 sites but let’s try https://GetAlongWithGod.com. If you can see how to adjust the css to fix this one I will go through the rest with the solution. Thank you!

    GeoIp plugin adds classes in the body tag. But your site has no classes in the body tag. I am guessing this is not the plugin issue. Check body tag in header.php of your wordpress theme. it should be something like this

    <body <?php body_class(); ?> >

    body_class() function will allow geoIp to add its classes to body tag

    • This reply was modified 6 years, 6 months ago by mafia99.
    • This reply was modified 6 years, 6 months ago by mafia99.

    Can you see if I inputted it correctly?

    I have tested all the sites and it seems to have worked. I put the <body <?php body_class(); ?> > class tag in the WP Admin under Settings> Cookie Consent> Styles> in the Container Class text box. It seems this did the trick coupled with the steps I listed above. Thank you very much Mafia99!

    I could not find header.php. Which folder I am supposed to look in? I added the <body <?php body_class(); ?> > class tag in the WP Admin under Settings> Cookie Consent> Styles> in the Container Class text box. However, this did not solve the problem. Still a large blank area above my site. My site: https://science-network.tv/

    Place this code into header.php or footer.php.

    <?php
    //Show cookie bar only for EU
    if( is_plugin_active( 'geoip-detect/geoip-detect.php' ) ) {
    	$userInfo = geoip_detect2_get_info_from_current_ip();
    	$countryCode = $userInfo->continent->code;
    	if($countryCode!="EU") {
    		?>
    		<style>
    		#catapult-cookie-bar{
    			padding: 0px !important;
    			max-height: 0px !important;
    			min-height: 0px !important;
    		}
    		</style>
    		<?php
    	}
    }
    ?>

    Replace the line if($countryCode!=”EU”) with the continent code you need.

    The popup showed up again today again. I put the code in the header.php and then in the footer.php and got this error message in both locations.

    Your PHP code changes were rolled back due to an error on line 43 of file wp-content/themes/getalong/footer.php. Please fix and try saving again.

    Uncaught Error: Call to undefined function is_plugin_active() in wp-content/themes/getalong/footer.php:43
    Stack trace:
    #0 wp-includes/template.php(688): require_once()
    #1 wp-includes/template.php(647): load_template(‘/home/readmk11/…’, true)
    #2 wp-includes/general-template.php(76): locate_template(Array, true)
    #3 wp-content/themes/getalong/index.php(76): get_footer()
    #4 wp-includes/template-loader.php(74): include(‘/home/readmk11/…’)
    #5 wp-blog-header.php(19): require_once(‘/home/readmk11/…’)
    #6 index.php(17): require(‘/home/readmk11/…’)
    #7 {main}
    thrown

    Changes to header.php is likely to be lost when the theme is updated. Surely it is not the intent with this plugin that the average WP-admin has to hack in php files. This should work using the settings within the plugin and I am sure that has been the intention. I just assume there is a glitch that needs to be fixed. Please also see the support thread “Problem hiding message for non European visitors.”

Viewing 15 replies - 1 through 15 (of 53 total)
  • The topic ‘GeoIP Detection Not Working’ is closed to new replies.