Support » Plugin: Complianz - GDPR/CCPA Cookie Consent » Google Maps not displaying anymore

  • Resolved bytefight

    (@bytefight)


    Hey,

    I have a little problem with your plugin in combination with the Google Map Integration from the Avada Theme. After installing your plugin the Google Map does not display at all, even if compliance is given for all categories. It seems like theres an error in the console (see in screenshot). When I deactivate the plugin everything works fine.

    Screenshots:
    https://ibb.co/PNQWGKw
    https://ibb.co/bPzDs4c

    If you need more information or assistance, let me know!

    Thanks in advance!
    Jonas

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

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Contributor Aert

    (@aahulsebos)

    Hi @bytefight,

    Could you try this and see if the maps shows, adding this to your functions.php:

    // Whitelisting inline script for Complianz
    add_filter ( 'cmplz_script_class',
    function( $class, $total_match, $found ) {
    if ( $found && false !== strpos( $total_match, 'google-maps-api-js' ) ) {
    $class = 'cmplz-native'; // add cmplz-script for Marketing and cmplz-stats for Statistics
    }
    return $class;
    }, 10 , 3
    );
    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    You can also try if this helps:

    Add the following strings
    fusionMapNonce,infobox_packed.js
    to this field
    “(part of) URL’s or unique string from the inline scripts of third-party scripts & plugins that should be blocked before consent.”

    in the script center, in complianz/integrations.

    This will also block the dependent scripts (which is now causing the issue). If that doesn’t work, you can also disable Google Maps in the services list in your script center.

    Thread Starter bytefight

    (@bytefight)

    Hey @rogierlankhorst & @aahulsebos

    I’ve integrated both of your proposals and it pretty much works as expected, although there is no placeholder that gets shown. So if there is no consent given the spot where the map is getting displayed normally is just white with no possible interaction. Is there a fix for this so that the typical google maps placeholder gets shown?

    Thank You!

    Plugin Contributor Aert

    (@aahulsebos)

    Hi @bytefight,

    Could you remove my option, to see if this works?

    regards Aert

    Thread Starter bytefight

    (@bytefight)

    Hi @aahulsebos

    I did that but still no placeholder: When compliance is not given by the user, there’s just an empty space in the spot where the map normally appears. When compliance is given the map does not get displayed and the console throws errors (when the snippet is commented out). I will leave the snippet commented in the functions.php so you can test better.

    Thanks!

    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    If you add a mu-plugin with the following code, I think the placeholder should appear.

    /**
     * Add a placeholder to a div with class "my-maps-class"
     * @param $tags
     *
     * @return mixed
     */
    function cmplz_fusionmaps_placeholder( $tags ) {
    	$tags['google-maps'][] = "fusion-google-map";
    	return $tags;
    }
    add_filter( 'cmplz_placeholder_markers', 'cmplz_fusionmaps_placeholder' );
    Thread Starter bytefight

    (@bytefight)

    Almost! Now the placeholder gets displayed but after clicking it the iframe doesn’t load. Only after I refresh the page again.

    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    Possibly one of the blocked scripts should wait for the other script before being activated. You can force this with another mu-plugin. My guess is that it should be like the below example, but if that doesn’t work you can also change the dependency (swap the strings).

    /**
     * Conditionally add the dependency
     * $deps['wait-for-this-script'] = 'script-that-should-wait';
     */
    
    function cmplz_custom_maps_dependencies( $tags ) {
    	$tags['infobox_packed.js'] = 'fusionMapNonce';
    	return $tags;
    }
    add_filter( 'cmplz_dependencies', 'cmplz_custom_maps_dependencies' );
    Thread Starter bytefight

    (@bytefight)

    Hey @rogierlankhorst.

    the snippet has no effect. I changed the strings but it didn’t change anything.

    Here’s my current functions.php snippet:

    /**
     * Add a placeholder to a div with class "my-maps-class"
     * @param $tags
     *
     * @return mixed
     */
    function cmplz_fusionmaps_placeholder( $tags ) {
    	$tags['google-maps'][] = "fusion-google-map";
    	return $tags;
    }
    add_filter( 'cmplz_placeholder_markers', 'cmplz_fusionmaps_placeholder' );
    
    // Whitelisting inline script for Complianz
    add_filter ( 'cmplz_script_class', function( $class, $total_match, $found ) {
      if ( $found && false !== strpos( $total_match, 'google-maps-api-js' ) ) {
        $class = 'cmplz-native'; // add cmplz-script for Marketing and cmplz-stats for Statistics
      }
      return $class;
    }, 10 , 3);
    
    /**
     * Conditionally add the dependency
     * $deps['wait-for-this-script'] = 'script-that-should-wait';
     */
    
    function cmplz_custom_maps_dependencies( $tags ) {
    	$tags['fusionMapNonce'] = 'infobox_packed.js';
    	return $tags;
    }
    add_filter( 'cmplz_dependencies', 'cmplz_custom_maps_dependencies' );
    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    We will try to set up a sandbox with this map implementation to see if we can fix it.

    Thread Starter bytefight

    (@bytefight)

    Thank You! I would love to stick to your Plugin!

    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    Hi @bytefight,

    I’ve done some tests, I can’t create a client side integration with this particular google maps implementation.

    As alternative, I can suggest the consent area shortcode solution:

    [cmplz-consent-area  text="Enable this content by clicking this link"]
    
    /* add your snippet or iFrame that needs to be blocked before consent */
    
    [/cmplz-consent-area]

    For the full explanation, please read this article:
    https://complianz.io/wrapping-content-in-consent-shortcodes/

    Thread Starter bytefight

    (@bytefight)

    Hi @rogierlankhorst,

    due to the capabilities of the Avada Fusion Builder this is not possible for me. Any other ideas on how to get this fixed?

    Thanks in advance!

    Thread Starter bytefight

    (@bytefight)

    Hi @rogierlankhorst,

    I can supply you with a copy of the Avada Theme, if this helps you! I’am using the standard Google Maps element of Avada in JS API Mode (as seen in the screenshot). Avada is pretty widespread so it may be good for you to support it in your plugin …

    Screenshot: https://ibb.co/PmwfRJp

    Kind regards,
    Jonas

    Plugin Contributor Aert

    (@aahulsebos)

    Hi @bytefight,

    We are looking at if, and how we can integrate. We will have more information by tomorrow,

    regards Aert

Viewing 15 replies - 1 through 15 (of 25 total)
  • You must be logged in to reply to this topic.