Add Google Analytics to New Universal Login

Problem statement

We want to add Google Analytics (GA) to the new UL. How to do it?

Solution

You can add GA to new UL via page templates by adding the script tag. However, you’re a bit limited in what you can do. Unless an element has a name/id property, there is no way to hook into its events. For example, custom parameters passed to authorize are not available in the page templates (like they are in classic UL). This prevents them from using GA link functionality, which includes a GA query parameter that could have been used for analytics.

Side note: If they use Classic UL, they can modify the HTML of the login page to include the Google Tag Manager script tag directly. This is also mentioned in the following community post for context: