@Override
    protected Event doExecuteInternal(final RequestContext requestContext) {
        val authn = WebUtils.getAuthentication(requestContext);
        val attributes = new LinkedHashMap<>(authn.getAttributes());
        attributes.putAll(authn.getPrincipal().getAttributes());

        val cookie = casProperties.getGoogleAnalytics().getCookie();
        val attributeName = cookie.getAttributeName();
        val attributeValuePattern = RegexUtils.createPattern(cookie.getAttributeValuePattern());

        LOGGER.trace("Available attributes are [{}] examined against cookie attribute name [{}] with value pattern [{}]",
            attributeName, attributeName, attributeValuePattern.pattern());

        if (StringUtils.isNotBlank(attributeName) && attributes.containsKey(attributeName)) {
            val values = CollectionUtils.toCollection(attributes.get(attributeName));
            LOGGER.trace("Attribute values found for [{}] are [{}]", attributeName, values);
            val cookieValue = values
                .stream()
                .map(Object::toString)
                .filter(value -> RegexUtils.find(attributeValuePattern, value))
                .collect(Collectors.joining(","));
            LOGGER.trace("Google analytics final cookie value is [{}]", cookieValue);

            val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
            val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(requestContext);
            googleAnalyticsCookieBuilder.addCookie(request, response,
                CookieRetrievingCookieGenerator.isRememberMeAuthentication(requestContext), cookieValue);
        }
        return null;
    }
This is {@link CreateGoogleAnalyticsCookieAction}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-google-analytics/src/main/java/org/apereo/cas/web/flow/CreateGoogleAnalyticsCookieAction.java