Avoid storing cookies generated by Google Analytics

Issue

  • When Google Analytics is enabled in Liferay cookies like _gid and _ga are stored in browser session. How can we avoid storing these cookies?

Environment

  • Liferay DXP (any version)

Resolution

  • Since Google Analytics is a third party this should be achieved through a custom development so there are different ways to achieve this goal. An example, based on the information provided by Google would be to override top_js.jspf file adding the configuration {storage:none} when Google Analytics's create command is triggered, so we'd need something like:
ga('create', '<%= HtmlUtil.escapeJS(googleAnalyticsId) %>', {
'storage': 'none'
});
ga('send', 'pageview');

 

Additional Information

 

¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0