Ametys version 3.7 integrates a standardized system for presenting visitors with a banner to inform them and offer them the option of accepting or refusing the use of cookies. This system is activated by default, and can be deactivated per site via the "Always accept cookies" configuration parameter (Services > Cookies).

The banner is only displayed if at least one feature that manages cookies is declared. By default, only Google Analytics uses cookies, and it is only activated if the "Google web ID" site parameter is set.

Use

Ametys 3.8 and higher

The system is activated by default, but a graphic charter may indicate that it does not support the banner with the following code:

<xsl:variable name="support-cookies-banner">false</xsl:variable>

However, the site administrator still has the power to force the use of cookies, even if the site charter supports cookies.

The default graphic rendering of the cookie acceptance bar can be modified by overriding the "body-cookiebanner-html" template, which should take the following form:

    <xsl:template name="body-cookiebanner-html">
        var html = '&lt;div class="cookiebanner-wrapper" id="cookie-banner">'
        + '&lt;div class="cookiebanner">'
        + '&lt;div class="cookiebanner-info">'
        + "<i18n:text i18n:key='PLUGINS_WEB_COOKIES_INFO' i18n:catalogue='plugin.web'/>"
        + ' '
        + '&lt;/div>'
        + '&lt;div class="cookiebanner-buttons">'
        + '&lt;a href="javascript:ametysAcceptCookieConsent()" class="cookiebanner-accept">'
        + "<i18n:text i18n:key='PLUGINS_WEB_COOKIES_INFO_ACCEPT' i18n:catalogue='plugin.web'/>"
        + '&lt;/a>'
        + ' '
        + '&lt;a href="javascript:ametysRefuseCookieConsent()" class="cookiebanner-refuse">'
        + "<i18n:text i18n:key='PLUGINS_WEB_COOKIES_INFO_REFUSE' i18n:catalogue='plugin.web'/>"
        + '&lt;/a>'
        + '&lt;/div>'
        + '&lt;/div>'
        + '&lt;/div>';
    </xsl:template>

 

Ametys 3.7

In version 3.7, in addition to the site parameter, it will be necessary to activate the functionality at the level of each compatible skin : the banner will be present only if the variable support-cookies-banner is declared with the value true. For example, in the demonstration chart, the following line should be added to the beginning of the file main.xsl :

<xsl:variable name="support-cookies-banner">true</xsl:variable>

Declaration of additional cookie systems

If a graphic charter proposes a specific functionality that uses cookies requiring the visitor's consent (for example, in France: http: //www.cnil.fr/vos-obligations/sites-web-cookies-et-autres-traceurs/), the easiest thing to do is to "plug in" to this standardized system: the functionality will directly know whether it should be activated (the visitor accepts cookies) or not (the visitor refuses cookies).

To do this, you need to generate a script javascript of the following form in your specific functionality:

<script type="text/javascript">
    var enableOrDisableMyCookieTrackingFeature = function(enable) {
        if (enable) {
            // Le site a désactivé le bandeau d'information ou l'utilisateur a autorisé les cookies : activer ma fonctionnalité.
        }
        else {
            // L'utilisateur a refusé l'utilisation de cookies : désactiver ma fonctionnalité et supprimer les éventuels cookies déjà présents.
        }
    }
    
    // Ajouter la fonction JS d'activation au tableau "ametysCookieConsentListener" : elle sera appelée quand le DOM est prêt.
    // La fonction reçoit un paramètre booléen : true si le site a désactivé le bandeau ou que l'utilisateur a autorisé les cookies, false sinon.
    ametysCookieConsentListener.push(enableOrDisableMyCookieTrackingFeature);
</script>

The standard Google Analytics integration is implemented in this way in the XSL ga.xsl file.

Back to top