Index: main/plugin-web/i18n/messages_fr.xml
===================================================================
--- main/plugin-web/i18n/messages_fr.xml	(revision 32800)
+++ main/plugin-web/i18n/messages_fr.xml	(working copy)
@@ -2397,5 +2397,14 @@
 	
     <message key="PLUGINS_WEB_RSS_COMMENTS_DESCRIPTION">Derniers commentaires sur {content}</message>
     <message key="PLUGINS_WEB_RSS_COMMENTS_LABEL">Flux RSS des commentaires</message>
+    
+    <!-- Cookies -->
+    <message key="PLUGINS_WEB_COOKIES_INFO">En poursuivant votre navigation sur ce site, vous acceptez l’utilisation de cookies à des fins de mesure d'audience.</message>
+    <message key="PLUGINS_WEB_COOKIES_INFO_REFUSE">Refuser</message>
+    <message key="PLUGINS_WEB_COOKIES_INFO_ACCEPT">Accepter</message>
+    <message key="PLUGINS_WEB_SITE_COOKIE_BANNER_LABEL">Conforme à la CNIL</message>
+    <message key="PLUGINS_WEB_SITE_COOKIE_BANNER_DESCRIPTION">Cocher la case si vous voulez laisser le choix à l'utilisateur s'il veut que le site utilise les cookies à des fins de mesure d'audience.</message>
+    <message key="PLUGINS_WEB_SITE_COOKIES_GROUP">Cookies</message>
+    
 </catalogue>
 	
\ No newline at end of file
Index: main/plugin-web/plugin.xml
===================================================================
--- main/plugin-web/plugin.xml	(revision 32800)
+++ main/plugin-web/plugin.xml	(working copy)
@@ -515,6 +515,13 @@
                     <category i18n="true">PLUGINS_WEB_SITE_SERVICES_CATEGORY</category>
                     <group i18n="true">PLUGINS_WEB_SITE_GOOGLE_GROUP</group>
                 </param>
+                <param id="cookie-banner" type="boolean">
+                    <label i18n="true">PLUGINS_WEB_SITE_COOKIE_BANNER_LABEL</label>
+                    <description i18n="true">PLUGINS_WEB_SITE_COOKIE_BANNER_DESCRIPTION</description>
+                    <category i18n="true">PLUGINS_WEB_SITE_SERVICES_CATEGORY</category>
+                    <group i18n="true">PLUGINS_WEB_SITE_COOKIES_GROUP</group>
+                    <default-value>false</default-value>
+                </param>
             </extension>
         </extensions>
     </feature>
Index: main/plugin-web/resources/js/jquery.cookie.js
===================================================================
--- main/plugin-web/resources/js/jquery.cookie.js	(revision 0)
+++ main/plugin-web/resources/js/jquery.cookie.js	(revision 0)
@@ -0,0 +1,115 @@
+/*!
+ * jQuery Cookie Plugin v1.4.1
+ * https://github.com/carhartl/jquery-cookie
+ *
+ * Copyright 2006, 2014 Klaus Hartl
+ * Released under the MIT license
+ */
+(function (factory) {
+	if (typeof define === 'function' && define.amd) {
+		// AMD (Register as an anonymous module)
+		define(['jquery'], factory);
+	} else if (typeof exports === 'object') {
+		// Node/CommonJS
+		module.exports = factory(require('jquery'));
+	} else {
+		// Browser globals
+		factory(jQuery);
+	}
+}(function ($) {
+
+	var pluses = /\+/g;
+
+	function encode(s) {
+		return config.raw ? s : encodeURIComponent(s);
+	}
+
+	function decode(s) {
+		return config.raw ? s : decodeURIComponent(s);
+	}
+
+	function stringifyCookieValue(value) {
+		return encode(config.json ? JSON.stringify(value) : String(value));
+	}
+
+	function parseCookieValue(s) {
+		if (s.indexOf('"') === 0) {
+			// This is a quoted cookie as according to RFC2068, unescape...
+			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
+		}
+
+		try {
+			// Replace server-side written pluses with spaces.
+			// If we can't decode the cookie, ignore it, it's unusable.
+			// If we can't parse the cookie, ignore it, it's unusable.
+			s = decodeURIComponent(s.replace(pluses, ' '));
+			return config.json ? JSON.parse(s) : s;
+		} catch(e) {}
+	}
+
+	function read(s, converter) {
+		var value = config.raw ? s : parseCookieValue(s);
+		return $.isFunction(converter) ? converter(value) : value;
+	}
+
+	var config = $.cookie = function (key, value, options) {
+
+		// Write
+
+		if (arguments.length > 1 && !$.isFunction(value)) {
+			options = $.extend({}, config.defaults, options);
+
+			if (typeof options.expires === 'number') {
+				var days = options.expires, t = options.expires = new Date();
+				t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
+			}
+
+			return (document.cookie = [
+				encode(key), '=', stringifyCookieValue(value),
+				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
+				options.path    ? '; path=' + options.path : '',
+				options.domain  ? '; domain=' + options.domain : '',
+				options.secure  ? '; secure' : ''
+			].join(''));
+		}
+
+		// Read
+
+		var result = key ? undefined : {},
+			// To prevent the for loop in the first place assign an empty array
+			// in case there are no cookies at all. Also prevents odd result when
+			// calling $.cookie().
+			cookies = document.cookie ? document.cookie.split('; ') : [],
+			i = 0,
+			l = cookies.length;
+
+		for (; i < l; i++) {
+			var parts = cookies[i].split('='),
+				name = decode(parts.shift()),
+				cookie = parts.join('=');
+
+			if (key === name) {
+				// If second argument (value) is a function it's a converter...
+				result = read(cookie, value);
+				break;
+			}
+
+			// Prevent storing a cookie that we couldn't decode.
+			if (!key && (cookie = read(cookie)) !== undefined) {
+				result[name] = cookie;
+			}
+		}
+
+		return result;
+	};
+
+	config.defaults = {};
+
+	$.removeCookie = function (key, options) {
+		// Must not alter options, thus extending a fresh object...
+		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
+		return !$.cookie(key);
+	};
+
+}));
+
Index: main/plugin-web/stylesheets/ga.xsl
===================================================================
--- main/plugin-web/stylesheets/ga.xsl	(revision 32800)
+++ main/plugin-web/stylesheets/ga.xsl	(working copy)
@@ -18,27 +18,46 @@
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:ametys="org.ametys.web.transformation.xslt.AmetysXSLTHelper"
     xmlns:escaper="org.apache.commons.lang.StringEscapeUtils"
+    xmlns:i18n="http://apache.org/cocoon/i18n/2.1" 
     extension-element-prefixes="ametys escaper">
     
     <xsl:template name="google-analytics">
         <xsl:variable name="webId" select="ametys:siteParameter('google-web-property-id')"/>
         
         <!-- Do not call GA on back or preview -->
-        <xsl:if test="ametys:renderingContext() = 'front' and normalize-space($webId) != ''">
-            <script type="text/javascript">
-            
-              var _gaq = _gaq || [];
-              _gaq.push(['_setAccount', '<xsl:value-of select="escaper:escapeJavaScript($webId)"/>']);
-              _gaq.push(['_trackPageview']);
-            
-              (function() {
-                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-              })();
-            
-            </script>
-        </xsl:if>
+<!--         <xsl:if test="ametys:renderingContext() = 'front' and normalize-space($webId) != ''"> -->
+	        <script type="text/javascript">
+	        
+	        ametysCookieConsentListener.push(function(accept)
+	            {
+				    var gaProperty = '<xsl:value-of select="escaper:escapeJavaScript($webId)"/>'
+				    
+	                if (accept)
+	                {
+				        var _gaq = _gaq || [];
+				        _gaq.push(['_setAccount', gaProperty]);
+				        _gaq.push(['_trackPageview']);
+				       
+				        (function() {
+				          var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+				          ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+				          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+				        })();
+	                }
+	                else
+	                {
+					    // Delete Google Analytics cookies    
+				        var cookieNames = ["__utma","__utmb","__utmc","__utmt","__utmv","__utmz","_ga","_gat"]
+				        for (var i=0; i&lt;cookieNames.length; i++)
+				        {
+				        debugger
+				            $j.removeCookie(cookieNames[i], { path: '<xsl:value-of select="ametys:siteUriPrefix()"/>' });
+			            }
+			        }
+		        }
+	        );
+	        </script>
+<!--         </xsl:if> -->
     </xsl:template>
     
 </xsl:stylesheet>
Index: main/workspace-web/stylesheets/template-default.xsl
===================================================================
--- main/workspace-web/stylesheets/template-default.xsl	(revision 32800)
+++ main/workspace-web/stylesheets/template-default.xsl	(working copy)
@@ -18,6 +18,8 @@
 	xmlns:xalan="http://xml.apache.org/xalan" 
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+	xmlns:ametys="org.ametys.web.transformation.xslt.AmetysXSLTHelper"
+    extension-element-prefixes="ametys"
 	exclude-result-prefixes="xalan">
 
 	<xsl:template name="favico">
@@ -37,6 +39,7 @@
         <script type="text/javascript">
               	$j = jQuery.noConflict();
 		</script>
+		<script type="text/javascript" src="{$uri-prefix}/plugins/web/resources/js/jquery.cookie.js"></script>
     </xsl:template>
     
     <xsl:template name="head-css-jquery">
@@ -101,4 +104,137 @@
         </script>
     </xsl:template>
     
+    <xsl:template name="head-js-cookiebanner">
+        <script type="text/javascript">
+        ametysCookieConsentListener = [];
+                
+        function ametysCallCookieConsentListener(accept)
+        {
+            for (var i = 0; i &lt; ametysCookieConsentListener.length; i++)
+            {
+               ametysCookieConsentListener[i].apply(window, [accept]);
+            }
+        }
+        
+<!--         <xsl:choose> -->
+<!-- 	        <xsl:when test="ametys:siteParameter('cookie-banner')"> -->
+		        ametysClickprocessed = false;
+		        ametysCookieExpireDay = 390;
+		        
+		        (function() { // anonymous function for scope purposes
+		        
+			        //Show the information banner to the top of the page
+			        function showBanner()
+			        {
+			           var html = '&lt;div class="cookiebanner" id="cookie-banner">';
+			           html += '&lt;div class="info-cookies" "id="cookie-banner-message" align="center">';
+			           html += "<i18n:text i18n:key='PLUGINS_WEB_COOKIES_INFO' i18n:catalogue='plugin.web'/>";
+			           html += ' ';
+			           html += '&lt;a href="javascript:ametysAcceptCookieConsent()">';
+			           html += "<i18n:text i18n:key='PLUGINS_WEB_COOKIES_INFO_ACCEPT' i18n:catalogue='plugin.web'/>";
+			           html += '&lt;/a>';
+			           html += ' ';
+			           html += '&lt;a href="javascript:ametysRefuseCookieConsent()">';
+			           html += "<i18n:text i18n:key='PLUGINS_WEB_COOKIES_INFO_REFUSE' i18n:catalogue='plugin.web'/>";
+			           html += '&lt;/a>';
+			           html += '&lt;/div>';
+			           html += '&lt;/div>';
+			
+			           $j(document.body).prepend(html).addClass('cookiebanner-visible');
+			        }
+			    
+			        //Get the Internet Explorer version, return -1 if not IE
+			        function getInternetExplorerVersion() {
+				        var rv = -1;
+				        if ($j.browser.msie)  
+				        {
+				            rv = $j.browser.version;
+				        } 
+				        
+				        return rv;
+			        }
+			        
+			        //Check the navigator value DoNotTrack to know if the signal is activated and equal to 1
+			        function notToTrack() {
+			            if ( (navigator.doNotTrack &amp;&amp; (navigator.doNotTrack=='yes' || navigator.doNotTrack=='1'))
+			                || ( navigator.msDoNotTrack &amp;&amp; navigator.msDoNotTrack == '1') ) {
+			                var isIE = (getInternetExplorerVersion()!=-1)
+			                if (!isIE){    
+			                     return true;
+			                }
+			                return false;
+			            }
+			        }
+			    
+			        //If the signal equals 0, consent is true
+			        function isToTrack() {
+			            if ( navigator.doNotTrack &amp;&amp; (navigator.doNotTrack=='no' || navigator.doNotTrack==0 )) {
+			                return true;
+			            }
+			        }
+			        
+			        function start() 
+			        {
+			            var consentCookie =  $j.cookie('hasConsent');
+			            
+			            if (!consentCookie) 
+			            {
+			                //The user has no cookies, we show the banner. 
+			                if (notToTrack() ) 
+			                { 
+			                    // Internet explorer DoNotTrack is not activated. Do not ask for consent and just opt him out
+			                    refuseCookie()
+			                } 
+			                else if (isToTrack() ) 
+		                    { 
+		                        // Internet explorer DoNotTrack is activated. Do not ask for consent and just opt him in
+		                        ametysAcceptCookieConsent();
+		                    } 
+	                        else 
+		                    {
+		                        // Otherwise ask the user
+	                            $j(window).on("load", showBanner);
+		                    }
+			            } 
+			            else 
+			            {
+		                    ametysCallCookieConsentListener($j.cookie('hasConsent') == 'true');
+			            }
+			        }
+			        
+		            start();
+			    })();
+			    
+			    function ametysRefuseCookieConsent()  
+		        {
+		            $j.cookie('hasConsent', false, {expires: ametysCookieExpireDay, path: '<xsl:value-of select="ametys:siteUriPrefix()"/>'});
+		            
+		            ametysClickprocessed = true;
+		            
+		            ametysCallCookieConsentListener(false);
+		            ametysHideInformCookieConsent();
+		        }
+		
+		        function ametysAcceptCookieConsent()
+		        {
+		            $j.cookie('hasConsent', true, {expires: ametysCookieExpireDay, path: '<xsl:value-of select="ametys:siteUriPrefix()"/>'});
+		            
+		            ametysCallCookieConsentListener(true);
+		            ametysHideInformCookieConsent();
+		        }
+		
+		        function ametysHideInformCookieConsent() 
+		        {
+		            $j("#cookie-banner").hide();
+		        }
+		        
+<!-- 	        </xsl:when> -->
+<!-- 	        <xsl:otherwise> -->
+<!-- 	            ametysCallCookieConsentListener(true); -->
+<!-- 	        </xsl:otherwise> -->
+<!--         </xsl:choose> -->
+        
+        </script>
+    </xsl:template>
+    
 </xsl:stylesheet>
\ No newline at end of file
Index: main/workspace-web/stylesheets/wrapper.xsl
===================================================================
--- main/workspace-web/stylesheets/wrapper.xsl	(revision 32800)
+++ main/workspace-web/stylesheets/wrapper.xsl	(working copy)
@@ -55,6 +55,7 @@
 				<xsl:call-template name="head-js-pirobox"/>	                	
                 
                 <xsl:call-template name="head-js-user"/>                      
+                <xsl:call-template name="head-js-cookiebanner"/>                      
                 
 				<xsl:call-template name="head-css-jquery"/>	                	
 				<xsl:call-template name="head-css-pirobox"/>
