WPConsent Blog

Everything you need to know about the WPConsent plugin

How to Stop Google Maps From Loading Before Consent in WordPress

How to Stop Google Maps From Loading Before Consent in WordPress 

Google Maps is a powerful tool for helping visitors find your business location, but it can also pose privacy concerns due to cookie tracking.

I discovered this when I received complaints from European visitors about my website not being GDPR-compliant because my maps were loading before getting consent.

Loading Google Maps automatically tracks visitor data through cookies and can store personal information like IP addresses and location data. This creates a privacy issue, especially for visitors from regions with strict data protection laws like GDPR or CCPA.

In this guide, I’ll show you how to block Google Maps widget before consent in WordPress.

Why Stop Google Maps Cookies Before Consent?

Have you ever visited a website and noticed the Google Maps loading right away, before you even had a chance to accept any cookies?

When you embed a standard Google Maps iframe or load the Google Maps API, it often loads cookies and potentially collects user data before your visitor has had a chance to agree to your site’s privacy policy or cookie usage.

Google Maps loads a variety of tracking cookies and scripts that collect user data. When the embedded iframes load automatically, they can track visitors’ IP addresses, browser information, and their precise location, all without explicit permission.

This cookie placement without explicit consent can result in violation of major data protection regulations like GDPR (General Data Protection Regulation), CCPA (California Consumer Privacy Act), and others. It can also lead to significant fines and remove the trust of your website visitors.

The good news is that you don’t have to sacrifice the utility of Google Maps to be compliant and respect user privacy. You can simply prevent the Google Maps widget from loading until the user has given their explicit consent. That said, let’s look at how you can easily do that in WordPress.

Blocking Google Maps Cookies Before Consent in WordPress

The best way to prevent Google Maps from automatically loading and adding cookies before consent is by using WPConsent. It is the best cookie consent management plugin for WordPress that’s easy to use and offers powerful features.

With WPConsent, you get Content Blocking feature that blocks the Google Maps widget until visitors make their choice about cookies. Once they accept, the map loads normally. If they decline, they’ll see a static placeholder instead.

The best part is that you can also block embedded videos from YouTube, Vimeo, and Dailymotion from loading before a user grants permission.

You can get started with the WPConsent Lite version for free. It includes the Content Blocking options and stops Google Maps widget from loading. However, for more advanced features like consent logs, modal banner design, and integrations, you can use the WPConsent Pro version.

First, you’ll need to install and activate the WPConsent plugin. If you need help, then please see this guide on how to install a WordPress plugin.

Once the plugin is active, you’ll see the WPConsent setup wizard. Go ahead and click the ‘Let’s Get Started’ button and follow the onscreen instructions.

WPConsent setup wizard

Next, you’ll need to head to WPConsent » Settings from the WordPress admin panel.

From here, you can scroll down to the ‘Content Blocking’ section. Go ahead and click the toggle to enable Content Blocking.

Enable content blocking option

As you enable the option, you’ll see different content providers, including YouTube, Vimeo, Dailymotion, Google Maps, and reCAPTCHA.

WPConsent will have all the services enabled by default. However, you can disable other content providers and only keep Google Maps active.

Select Google Maps in content blocking

Besides that, you can also change the text that will appear in the ‘Placeholder Button’ field. Once you’re done, don’t forget to save the changes.

From here, simply visit your site to see Content Blocking in action.

View google maps placeholder

To load the Google Maps widget on your site, your visitors will need to click on the map to accept cookies and load the map. They can also click the ‘Accept’ button in the cookie consent banner.

I hope this article helped you learn how to block Google Maps widget before consent in WordPress. You may also want to see our guide on what are tracking cookies and how to manage cookie consent data in WordPress.

If you liked this article, then please follow us on X (formerly known as Twitter). You can also leave a comment below if you need any assistance.

Add A Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.


Popular Resources

Get free tips and resources right in your inbox, along with 500+ others

Follow Us