Google Maps still visible
-
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/mapsAny idea?
Thanks,
AndreasThe page I need help with: [log in to see the link]
-
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.jsFor 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');-
This reply was modified 6 years, 5 months ago by
Rogier Lankhorst.
What is the name of the maps plugin you use by the way?
Hi Rogier,
maps.googleapis.com
g1-gmaps.jsis 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 6 years, 5 months ago by
fotobeam.
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.
Ok, I will send you the plugin.
Many thanks for your help!
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,
AndreasI 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=1You 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');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.
Hi Rogier,
Many thanks again. I will recommend your plugin to people with Cookie/Compliance challenges!
Best
AndreasInteresting 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 -
This reply was modified 6 years, 5 months ago by
The topic ‘Google Maps still visible’ is closed to new replies.