• Resolved fotobeam

    (@apachelance)


    Hi,

    Currently I am trying to block Google Maps. However it won’t work. I already included several scripts and URLs in the ScriptCenter without success:

    map.js
    maps.gstatic.com
    g1-gmaps.js?ver=0.6.3
    google.com/maps

    Any idea?

    Thanks,
    Andreas

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Hi @apachelance,

    You use a dedicated plugin, which loads the maps in a div. There are three javascripts from this plugin, but I think you only need to add these two to the script center:
    – maps.googleapis.com
    – g1-gmaps.js

    For a nice looking placeholder, you’ll need the following custom code:

    function my_cmplz_g1maps_placeholder($tags){
        $tags['google-maps'] = 'g1gmap-main';
        return $tags;
    }
    add_filter('cmplz_placeholder_markers', 'my_cmplz_g1maps_placeholder');
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    What is the name of the maps plugin you use by the way?

    Thread Starter fotobeam

    (@apachelance)

    Hi Rogier,

    maps.googleapis.com
    g1-gmaps.js

    is included in the Scriptcenter, but the map is still there.

    The Plugin is called G1 GMaps…it came bundled with the theme. However I tried WP Google Map Plugin and had the same issue.

    Andreas

    • This reply was modified 4 years, 10 months ago by fotobeam.
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    WP Google Maps uses its own GDPR feature, which we integrate with, but as it uses PHP cookies, it won’t work with caching. The plugin should be enabled in the integrations section, and its own GDPR feature should be enabled (Complianz should enable it automatically).

    The default Google Maps implementation should look like this:
    https://demo.complianz.io/placeholders/google-maps/

    If you can send over your G1 Gmaps plugin zip file to [email protected], I can work out an integration.

    Thread Starter fotobeam

    (@apachelance)

    Ok, I will send you the plugin.

    Many thanks for your help!

    Thread Starter fotobeam

    (@apachelance)

    I found the problem: Unfortunately I did not comma-separated the scripts. Instead I had one script in every line.

    It is working now.

    Thanks,
    Andreas

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    I have tested an integration with the G1 Gmaps plugin, this works on my local setup:
    https://github.com/rlankhorst/complianz-gdpr/compare/G1-Gmaps-integration?expand=1

    You can download this branch from Git (integration module will also be shipped with the next update), or add some custom code as shown below. You can put this in a mu-plugin (recommended) or in your theme’s functions.php:

    /**
     * These are the scripts that will be blocked, you can also put them in the 
     * script center, but this is how it's used in the integration module
     */
    
    add_filter('cmplz_known_script_tags', 'cmplz_wp_google_maps_widget_script');
    function cmplz_wp_google_maps_widget_script($tags){
        $tags[] =  'g1-gmaps.js';
        $tags[] =  'infobox_packed.js';
        $tags[] =  'maps.googleapis.com';
        return $tags;
    }
    
    /**
     * This makes sure the scripts are loaded in the correct order, which may have 
     * been the problem on your site 
     */
    
    add_filter('cmplz_dependencies', 'cmplz_contactform7_dependencies');
    function cmplz_contactform7_dependencies($tags){
    
    	$tags['maps.googleapis.com']='g1-gmaps.js';
    
    	return $tags;
    }
    
    /**
     * Add placeholder for google maps. Not necessary, but looks nice.
     * @param $tags
     *
     * @return mixed
     */
    
    function cmplz_g1maps_placeholder($tags){
    	$tags['google-maps'] = 'g1gmap-main';
    	return $tags;
    }
    add_filter('cmplz_placeholder_markers', 'cmplz_g1maps_placeholder');
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Hi @apachelance,

    Posted, then saw your message ??

    If you want a placeholder, you can use the placeholder code from above. If you see any console errors, this is because of the dependency, you can also add the dependency separately to prevent the console errors.

    One last thing: if you use the functions above, please prefix the functions to make sure you won’t get PHP errors on the next update: these function will be used in the plugin.

    Thread Starter fotobeam

    (@apachelance)

    Hi Rogier,

    Many thanks again. I will recommend your plugin to people with Cookie/Compliance challenges!

    Best
    Andreas

    Thread Starter fotobeam

    (@apachelance)

    Interesting fact: It was enough to add your placeholder code to the functions.php. It was not necessary to add anything else to the Scriptcenter. So I removed

    – maps.googleapis.com
    – g1-gmaps.js

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Google Maps still visible’ is closed to new replies.