# How to execute some JS code before redirecting to SSO

**URL:** https://meta.discourse.org/t/how-to-execute-some-js-code-before-redirecting-to-sso/191958
**Category:** SSO
**Created:** [May 28, 2021, 6:20pm UTC](https://meta.discourse.org/t/how-to-execute-some-js-code-before-redirecting-to-sso/191958 "2021-05-28T18:20:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nicolas\_Blanco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicolas_blanco/32/105141_2.png) [@Nicolas\_Blanco](https://meta.discourse.org/u/Nicolas_Blanco)
#### Post date: [May 28, 2021, 6:20pm UTC](https://meta.discourse.org/t/how-to-execute-some-js-code-before-redirecting-to-sso/191958/1 "2021-05-28T18:20:25Z")

</div>

Hello,

I have my Discourse platform with SSO configured and working.

How is it possible to execute some client-side JS code when the user is clicking on the Login button before he/she gets redirected.

I would like to do that to send a Google Analytics event.

Thanks.
