Google Analytics Tracking

You could pass in a referral parameter when you initiate the /authorize call to Auth0. You would have to adapt the following and then add the parameter value to your Google Analytics call:

Example url:

[https://TENANT.auth0.com/authorize?client_id=SOME_CLIENT_ID&response_type=token%20id_token&redirect_uri=http%3A%2F%2Flocalhost%2Fsamples%2Fspa%2F&scope=openid%20profile%20email&com_customer_namespace_some_setting=this%20is%20some_setting&com_customer_namespace_another_setting=this%20is%20another_setting&state=uxzt12345GfQMlTSi&nonce=ntUCsEkwh_xgexuDM2gI1iedJyPiiY2E&auth0Client=SOME_CLIENT](https://tenant.auth0.com/authorize?client_id=SOME_CLIENT_ID&response_type=token%20id_token&redirect_uri=http%3A%2F%2Flocalhost%2Fsamples%2Fspa%2F&scope=openid%20profile%20email&com_customer_namespace_some_setting=this%20is%20some_setting&com_customer_namespace_another_setting=this%20is%20another_setting&state=uxzt12345GfQMlTSi&nonce=ntUCsEkwh_xgexuDM2gI1iedJyPiiY2E&auth0Client=SOME_CLIENT)

//custom code on Universal Login page.

<script src="https://cdn.auth0.com/js/lock/11.17/lock.min.js"></script>

  <script>

    // Decode utf8 characters properly

    var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));

    config.extraParams = config.extraParams || {};

    var someCustomParam = config.internalOptions.com_customer_namespace_some_setting;

    //Example of setting email input to custom param value

    if(someCustomParam){

        document.getElementById('email').value = someCustomParam;

    }

  </script>

</script>
1 Like