I need some help understanding tracking from Auth0 lock page to Google analytics. from the image below we can see multiple sources of traffic; what we are having difficulty with is understanding where a user comes from when they land on Auth0. Is there a way for us to pass this information through from Auth0 to analytics?
Thanks
Rory
Hey there @rory.standley
Let me discuss it with the appropriate team and get back to you with the news soon!
Have you integrated your Google Analytics snippet into the Auth0 Universal Login Page? (Dashboard > Universal Login > Login > Customize the Login Page)
Yeah I have added that in with the correct UA code
Confirming it with the team responsible for Lock. Will get back to you shortly!
The team asked if you can check if you’re using the analytics script as recommended here:
https://auth0.com/docs/analytics/guides/google-analytics
it’s probably something missing there. Lock doesn’t get involved with Google Analytics really other than raising events when something happens
2 Likes
Hey there!
Have you had a chance to check my previous message?
jb0
April 10, 2020, 3:53pm
10
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
Thanks a lot for sharing that @jb0 !