class GoogleAnalyticsDataLayerInterceptor extends HandlerInterceptorAdapter {

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {

        if (modelAndView == null) {
            return;
        }

        final GoogleAnalyticsDataLayer dl = getOrCreateDataLayer(modelAndView);

        if (modelAndView.getViewName() != null && modelAndView.getViewName().startsWith("redirect:")) {
            return;
        }

        setCompetitionName(dl, request, modelAndView);
        setUserRoles(dl, request);
        setApplicationId(dl, request, modelAndView);
    }

}