• Resolved hupe13

    (@hupe13)


    I am the author of the Extensions for Leaflet Map and I tested its integration.

    For a simple map with a marker it works. But Gesture Handling (from Extensions) does not work after I agreed. After reloading the page it works. I changed the snippet for this because the filename changed: leaflet-gesture-handling.min.js.

    But there are more problems. Some things are loaded asynchronously, these do not work even if you reload. For example if you want to display a geojson file (shortcode leaflet-geojson from Leaflet Map) or an elevation profile (shortcode elevation from Extensions).

    How to configure complianz-gdpr to get this working?

    Thank you very much.

    • This topic was modified 1 year, 9 months ago by hupe13.
    • This topic was modified 1 year, 9 months ago by hupe13.

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

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter hupe13

    (@hupe13)

    Ok, it may be, that this was a configuration or caching problem. I checked all settings again, now the most work. But the Gesture Handling problem remains.

    Thread Starter hupe13

    (@hupe13)

    It is a setting problem: If I set “Respect Do Not Track and Global Privacy Control?” to yes, the problems occur again. If this setting is no, all except Gesture Handling works.

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @hupe13,

    I expect that when another Map variant is used, elevation for example, it results in an additional JavaScript file/dependency being loaded, which will also have to be blocked in the integration file.

    Otherwise the elevation script would be loaded while the others are still blocked, resulting in a failure for the Map to initialize correctly. I see that the current ‘leaflet’ integration doesn’t correctly block all of those scripts and dependencies.

    Could you try replacing the Leaflet integration with the below version? I haven’t verified it myself yet, but this version also blocks the Leaflet Extensions and tells them to wait for the “main” Leaflet script to load.

    <?php
    defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
    
    add_filter( 'cmplz_known_script_tags', 'cmplz_leafletmaps_directory_script' );
    function cmplz_leafletmaps_directory_script( $tags ) {
    	$tags[] = array(
    		'name' => 'openstreetmaps',
    		'category' => 'marketing',
    		'placeholder' => 'openstreetmaps',
    		'urls' => array(
    			'WPLeafletMapPlugin',
    			'leaflet-gesture-handling',
    			'extensions-leaflet-map',
    		),
    		'enable_placeholder' => '1',
    		'placeholder_class' => 'leaflet-map',
    		'enable_dependency' => '1',
    		'dependency' => [
    			//'wait-for-this-script' => 'script-that-should-wait'
    			'WPLeafletMapPlugin' => 'leaflet-gesture-handling',
    			'WPLeafletMapPlugin' => 'extensions-leaflet-map',
    		],
    	);
    	return $tags;
    }
    
    /**
     * Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
     *
     * @param $services
     *
     * @return array
     */
    
    function cmplz_leafletmaps_directory_detected_services( $services ) {
    	if ( ! in_array( 'openstreetmaps', $services ) ) {
    		$services[] = 'openstreetmaps';
    	}
    
    	return $services;
    }
    
    add_filter( 'cmplz_detected_services', 'cmplz_leafletmaps_directory_detected_services' );

    Let me know if that does the trick!

    Kind regards, Jarno

    Thread Starter hupe13

    (@hupe13)

    'dependency' => [
    			//'wait-for-this-script' => 'script-that-should-wait'
    			'WPLeafletMapPlugin' => 'leaflet-gesture-handling',
    			'WPLeafletMapPlugin' => 'extensions-leaflet-map',
    		],

    What must be inserted for “script-that-should-wait”? The plugin slug, the name of the js file or the path of the js file or what?

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @hupe13,

    Any unique identifier that is present in the script that should be blocked (this could be a part of the filename/the full filename, or a part of the path etc).

    I used the folder name of your plugin (/extensions-leaflet-map/) as the identifier, so the integration is not dependent on the extension’s file name, but would trigger on any script that contains the extensions-leaflet-mapfolder name.

    Kind regards, Jarno

    • This reply was modified 1 year, 9 months ago by jarnovos.
    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @hupe13,

    I can additionally recommend this article, which provides a more in-depth explanation about the creation of custom integrations: https://complianz.io/custom-google-maps-implementation/

    Kind regards, Jarno

    Thread Starter hupe13

    (@hupe13)

    You don’t need any dependency configurations. I changed the script:

    <?php
    defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
    
    function cmplz_leafletmaps_directory_script( $tags ) {
    	$tags[] = array(
    		'name' => 'openstreetmaps',
    		'category' => 'marketing',
    		'placeholder' => 'openstreetmaps',
    		'urls' => array(
    			'WPLeafletMapPlugin',
    		),
    		'enable_placeholder' => '1',
    		'placeholder_class' => 'leaflet-map',
    		'enable_dependency' => '0',
    		'dependency' => [
    			//'wait-for-this-script' => 'script-that-should-wait'
    			],
    		);
    		return $tags;
    	}
    	add_filter( 'cmplz_known_script_tags', 'cmplz_leafletmaps_directory_script' );
    
    	/**
    	* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
    	*
    	* @param $services
    	*
    	* @return array
    	*/
    
    	function cmplz_leafletmaps_directory_detected_services( $services ) {
    		if ( ! in_array( 'openstreetmaps', $services ) ) {
    			$services[] = 'openstreetmaps';
    		}
    		return $services;
    	}
    	add_filter( 'cmplz_detected_services', 'cmplz_leafletmaps_directory_detected_services' );

    And I changed my code for Gesture Handling, now it works.

    But I still have problems with “Do not track” and setting “Respect Do Not Track and Global Privacy Control?” to yes. On the page with the first map I agree, the page is displayed. When I go to the next page or load the same page again, the banner appears and I can’t continue.

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @hupe13,

    I see what you’re referring to. I’ve replicated that behavior on a sandbox environment, and we’re looking into it as we speak.

    Kind regards, Jarno

    Plugin Contributor jarnovos

    (@jarnovos)

    Hello @hupe13,

    Please install this version of Complianz, it will fix the described DNT issue: https://github.com/Really-Simple-Plugins/complianz-gdpr/tree/DNT-on-embedded-content

    The cmplz_has_consent function returned ‘false’ in case of DNT, but when the user contents to embedded content, there is consent; and that is what caused the issue to occur.

    Curious to hear about your findings with this version.

    Kind regards, Jarno

    Thread Starter hupe13

    (@hupe13)

    Hello @jarnovos,

    it works now. Thank you very much.
    But I’m having trouble with a very specific page, I’ve tried to solve it but I can’t manage it. The page loads javascript from a file. But I get Javascript errors if Complianz is active and the fields remain empty. Maybe you know a solution.

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @hupe13,

    Would it be possible for you to temporarily re-enable Complianz on the page in question, so that we can take a closer look at the JS errors that appear in the console?

    Kind regards, Jarno

    Thread Starter hupe13

    (@hupe13)

    I made a test site with Complianz enabled.

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @hupe13,

    This does look like a dependency error. Please contact complianz.io/contact/ and mention this thread an that you’re a developer of this plugin, so we can work together more easily.

    Thanks, regards Aert

    Thread Starter hupe13

    (@hupe13)

    It works now. Thank you very much.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Leaflet Map and its Extensions’ is closed to new replies.