<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y00006PHk55SADOkta Classic EngineSingle Sign-OnAnswered2024-03-25T03:43:00.000Z2019-07-02T15:55:14.000Z2019-07-05T15:30:52.000Z

ouna7 (ouna7) asked a question.

Okta widget Trigger Google analytics Event on invalid Login

I am a javascript developer implementing Okta widget in our website. When user provides invalid credentials we want to track that as an Event in GoogleAnalytics.

I tried using function error() on renderEl but that is not triggered for invalid login


  • Hello Uday,

     

    The error() function in renderEl is used and called when the widget has been initialized with invalid config options, or has entered a state it cannot recover from, such as being unable to load the forms for example.

    What you have to use is a bit lower in the GitHub guide, which is the 'afterError' Event:

    https://github.com/okta/okta-signin-widget#aftererror

    This will allow you to track and pass the invalid credential failures as you wish.

    Also, the Okta System Log will contain these failures, which can be also pulled using our Logs API if that helps.

     

    You can further development inquiries on our devforum here to get on topic replies as quickly as possible, but you can of course also inquire with us here. Here is the link: https://devforum.okta.com/

    You can also raise any particular issues or concerns under the github repository, if you noticed any other particular issues.

     

    I hope this helps, feel free to open a support ticket or raise the inquiry on our dev forum.

     

    Thank you,

     

    Bogdan Andrisan

    Okta Customer Support

    Expand Post
  • ouna7 (ouna7)

    @Bogdan Andrisan

    I used the following code, but on invalid login i see 401 Unauthorized and afterError function is not invoked.

     

    oktaSignIn.on('afterError', function (context, error) {

     var errName = error.message || 'Invalid Login'; 

     _gaq.push(['_trackEvent', 'OktaLogin', errName]);

     });

    Expand Post
This question is closed.
Loading
Okta widget Trigger Google analytics Event on invalid Login