Make the plugin GDPR/DSGVO compliance


General Data Protection Regulation (GDPR or DSGVO in Germain) is a law on data protection and privacy for people within the European Union. It applies to any data collected from the citizens of EU from anywhere in the world. GDPR aims to give EU citizens control over their personal data and to regulate the approach of international business.

The following tutorial will show you how to add a message before loading your map in order to inform your EU users that Google Maps may store their personal data like the IP address, location, etc… More details can be found at https://cloud.google.com/security/gdpr

Add the following code to the file “functions.php” of your theme/child theme (this code works with “Progress Map v5.6.2 and above!):

This code will reload the map page if the user accepts using Google Maps, otherwise, the code will redirect to another page (e.g. Hompage).

In the code, change ‘#’ by the hompage URL or any other link (e.g. ‘www.mywebsite.com/homepage’)!

add_action('cspm_do_before_map_load', function(){
	wp_add_inline_script("cspm-script", 
	   "if(!document.cookie.split('; ').find(row => row.startsWith('CSPM-UseGoogleMaps=true'))) {
		   	
			window.stop();
			
			var homepage_url = '#';
			var message = 'This website uses Google Maps. I consent to Google receiving the IP address of my device and other technical data for the display of maps and for its own purposes. When activated, this data is transmitted to Google.';
			   	
			var d = new Date();
			var exdays = 1;
			d.setTime(d.getTime() + (exdays*24*60*60*1000));
			var expires = 'expires='+ d.toUTCString();
		
		   	iziToast.question({
				id: 'GDPR_DSGVO_warning',
				title: '',
				timeout: false,
				message: message,
				position: 'center',
				transitionIn: 'fadeIn',
				close: false,
				overlay: true,
				overlayClose: false,
				drag: false,
				zindex:99999,
				toastOnce: true,
				maxWidth: '500px',
				buttons: [
					['', function (instance, toast) {
						instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');	
						document.cookie = 'CSPM-UseGoogleMaps=true;' + expires;					
						window.location.reload();
					}, true],
					['', function (instance, toast) {
						instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
						document.cookie = 'CSPM-UseGoogleMaps=false;' + expires;
						document.location = homepage_url;
					}],
				],
			});
			
	   }"
	);
});

In the same context