mhirdes / go_maps_ext

Google Maps Extension for TYPO3
MIT License
21 stars 31 forks source link

Support consent management tools #78

Closed dahaupt closed 1 year ago

dahaupt commented 4 years ago

Cookie consent tools often have the requirement to add specific data-attributes (e.g. data-src and data-name) in order to load scripts only when consent is given.

Currently it seems necessary to override MapController->initializeAction and ScriptViewHelper->render to correctly include the scripts with necessary data-attributes (using PageRenderer->addFooterData).

Another current challenge is to include the scripts in the correct order. Would be awesome to ease this afford and allow easy integration into third-party consent management tools.

mhirdes commented 4 years ago

Hi, you can use the TypoScript Setting plugin.tx_gomapsext.preview.enabled = 1. So the Api is not included directly. Then override the partial Resources/Private/Partials/Preview.html. Otherwise how would a good solution for you look like? You can also write on slack.

dahaupt commented 4 years ago

Hey @mhirdes, thanks for your feedback!

I am aware of the preview functionality, but IMO the extension (or extensions in general) should not each include an individual opt-in mechanism as this should be primarily the task of a cookie consent tool. If each extension handles this on its own, configuration for those consent tools is more complex than it should be.


In my world, a cookie consent tool:

Basically each functionality described above is more or less already integrated into the extension. In general, I would recommend to remove the functionality and refer to the use of a cookie consent tool. However, this simple preview might be sufficient for many smaller projects without many cookies and services.


In order to make the integration for cookie consent tools easier, I would propose to:

Looking forward to your feedback! (Slack: dahaupt)

mhirdes commented 3 years ago

Hi @dahaupt,

sry for the late response. I checked again the current preview mode. To overwrite the partial and take a look at the jquery.gomapsext.preview.js it's a good example how to initialize the map. Of course costumization is needed.

But I wrote you an slack today. May we can write there to find a good solution.

deadmanIsARabbit commented 3 years ago

May I ask if you two have found a solution in your Slack discussion?

dahaupt commented 3 years ago

@deadmanIsARabbit Unfortunately, I have not responded back to @mhirdes, yet. Will try to find the time to look into this topic again!

bardimardy commented 3 years ago

Hey @mhirdes and @dahaupt, I got the same question as @deadmanIsARabbit, ran into the same issue some days ago and it would be great to see a solution coming. Until this will happen I have to find a workaround for this issue.

Currently this appears in combination with the cookieman extension.

bardimardy commented 2 years ago

If somebody got the same issue, I want to quickly describe a workaround for you to get GoMapsExt working in preview mode running together with a cookie consent tool. In my case it was Cookieman.

<script>
const $element = $('.tx-go-maps-ext');
if ($element) {
    $.when($.getScript('/typo3conf/ext/go_maps_ext/Resources/Public/Scripts/markerclusterer_compiled.js'),
           $.getScript('/typo3conf/ext/go_maps_ext/Resources/Public/Scripts/jquery.gomapsext.js'),
        $.Deferred(function (deferred) {
            $(deferred.resolve);
        })).done(function () {
        $('script[data-name="googleMapCE"]').each(function () {
            $.getScript($(this).data('src'));
        });
    });
}
</script>

Now your preview link will show the maps after clicked.

ProWebs commented 1 year ago
  • ScriptViewHelper

Can you descripe it more detailed, were can i find the "ScriptViewHelper" on filesystem and how to override it? Copy code on a special place in this file? Or is there another way, to keep cookieman ready for future updates without override you workaround.

mhirdes commented 1 year ago

You don't need to overwrite the script ViewHelper. The tempJavaScriptFile dosen't load any external function.

You can set in the extension manager config, that you load the JS by your own, if the preview function as it self works not for you.

mhirdes commented 1 year ago

If any other help is needed for this topic, please contact me on slack