WORKERS AHEAD!
You are viewing the development documentation for the Apereo CAS server. The functionality presented here is not officially released yet. This is a work in progress and will be continually updated as development moves forward. You are most encouraged to test the changes presented.
Google Analytics
Google Analytics can be used to deliver useful statistics. create custom dimensions and metrics to gain insight into CAS and user traffic.

Google Analytics 4 is the next-generation measurement solution, and it has replaced Universal Analytics in CAS. On July 1, 2023, standard Universal Analytics properties will stop processing new hits. If you still rely on Universal Analytics, we recommend that you prepare to use Google Analytics 4 going forward.
Support is enabled by including the following module in the WAR Overlay:
1
2
3
4
5
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-google-analytics</artifactId>
<version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-google-analytics:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
imports {
mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
}
}
dependencies {
implementation "org.apereo.cas:cas-server-support-google-analytics"
}
1
2
3
4
5
6
dependencies {
implementation enforcedPlatform("org.apereo.cas:cas-server-support-bom:${project.'cas.version'}")
implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
implementation "org.apereo.cas:cas-server-support-google-analytics"
}
Furthermore, CAS presents the ability to drop in a special cookie upon successful authentication events to be later process and consumed by Google Analytics. The value of this cookie is determined as a principal/authentication attribute.
The following settings and properties are available from the CAS configuration catalog:
cas.google-analytics.google-analytics-tracking-id=
The tracking id. Configuring the tracking activated google analytics in CAS on UI views, etc. |
cas.google-analytics.cookie.attribute-name=
Attribute name to collect from the authentication event to serve as the cookie value. |
cas.google-analytics.cookie.attribute-value-pattern=.+
A regular expression pattern that is tested against attribute values to only release and allow those that produce a successful match. This settings supports regular expression patterns. [?]. |
cas.google-analytics.cookie.domain=
Cookie domain. Specifies the domain within which this cookie should be presented. The form of the domain name is specified by RFC 2965. A domain name begins with a dot (.foo.com) and means that the cookie is visible to servers in a specified Domain Name System (DNS) zone (for example, www.foo.com, but not a.b.foo.com). By default, cookies are only returned to the server that sent them. |
cas.google-analytics.cookie.http-only=true
true if this cookie contains the HttpOnly attribute. This means that the cookie should not be accessible to scripting engines, like javascript. |
cas.google-analytics.cookie.max-age=-1
The maximum age of the cookie, specified in seconds. By default, |
cas.google-analytics.cookie.name=
Cookie name. Constructs a cookie with a specified name and value. The name must conform to RFC 2965. That means it can contain only ASCII alphanumeric characters and cannot contain commas, semicolons, or white space or begin with a |
cas.google-analytics.cookie.path=
Cookie path. Specifies a path for the cookie to which the client should return the cookie. The cookie is visible to all the pages in the directory you specify, and all the pages in that directory's subdirectories. A cookie's path must include the servlet that set the cookie, for example, /catalog, which makes the cookie visible to all directories on the server under /catalog. Consult RFC 2965 (available on the Internet) for more information on setting path names for cookies. |
cas.google-analytics.cookie.same-site-policy=
If a cookie is only intended to be accessed in a first party context, the developer has the option to apply one of settings SameSite=None , to designate cookies for cross-site access. When the SameSite=None attribute is present, an additional Secure attribute is used so cross-site cookies can only be accessed over HTTPS connections. Accepted values are:
|
cas.google-analytics.cookie.secure=true
True if sending this cookie should be restricted to a secure protocol, or false if the it can be sent using any protocol. |