iDP overriding referrer | Community
Skip to main content
Level 2
May 23, 2023
Solved

iDP overriding referrer

  • May 23, 2023
  • 1 reply
  • 566 views

My website can be accessed only once the User is logged into the organization's iDP. If the user attempts to access the website without an active session, they are redirected to the iDP login page which then loads the website.

 

This behavior causes the Referrer URL to be updated to the iDP URL.
www.example.com  --> (redirect) www.idplogin.com  --> www.aawebpage.com 
Referrer: www.idplogin.com

 

So we are missing a lot of Referrer URLs which gets merged into the idplogin URL.
Is there a way around this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jennifer_Dungan

You may need to ask your developers to make changes on your IDP and Websites....

A few options:
1. It sounds like user might follow the flow of:
Google > Website > (auto redirect to) IDP > (Login action) > Website
So you may have to override the headers on the redirect from website to IDP, then again on the redirection from the IDP to the website....

But, this requires server side changes and overwriting the referrer in the headers... 

The problem here, is that your IDP code might be using those initial headers to determine which website to send the users to after login... and may not be a viable option

 

 

2. You may need to add the "referrer" as a custom parameter through all these redirects, so that IF you have that param when the user lands on your site, you read from this param and overwrite the referrer. If there is no referrer on the IDP site, pass a special "none" value so that you can tell the difference between direct traffic to IDP, vs actual referrers to IDP.... (i.e. ?referrer=https%3A%2F%2Fwww.google.com  or ?referrer=none)

 

Basically, you can set up a normal Data Element to pull the referrer, then a second Data Element to read the existence of the "referrer param". Then create a custom code Data Element that uses logic to choose which to use....

 

var realReferrer = _satellite.getVar('referrer'); var paramReferrer = _satellite.getVar('paramreferrer'); var finalReferrer = ''; // Check if the referrer is "IDP" AND there is a parameter query string, this also helps prevent "back" navigation to the url with the param to not "double track" the referrer if (realReferrer.indexOf('www.idplogin.com') > -1 && paramReferrer){ // if the passed referrer is not "none", then set the referrer to the passed value if (paramReferrer != "none"){ finalReferrer = paramReferrer; } // since the default value is already nothing, "none" should pass as empty } else { // If someone is logged in, and doesn't go through the IDP, this should pick up the real referrer finalReferrer = realReferrer; } return finalReferrer;

 

You can also add your IDP domain as an internal URL filter to make sure it doesn't show up in your referrers report.

1 reply

Jennifer_Dungan
Community Advisor and Adobe Champion
Jennifer_DunganCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
May 23, 2023

You may need to ask your developers to make changes on your IDP and Websites....

A few options:
1. It sounds like user might follow the flow of:
Google > Website > (auto redirect to) IDP > (Login action) > Website
So you may have to override the headers on the redirect from website to IDP, then again on the redirection from the IDP to the website....

But, this requires server side changes and overwriting the referrer in the headers... 

The problem here, is that your IDP code might be using those initial headers to determine which website to send the users to after login... and may not be a viable option

 

 

2. You may need to add the "referrer" as a custom parameter through all these redirects, so that IF you have that param when the user lands on your site, you read from this param and overwrite the referrer. If there is no referrer on the IDP site, pass a special "none" value so that you can tell the difference between direct traffic to IDP, vs actual referrers to IDP.... (i.e. ?referrer=https%3A%2F%2Fwww.google.com  or ?referrer=none)

 

Basically, you can set up a normal Data Element to pull the referrer, then a second Data Element to read the existence of the "referrer param". Then create a custom code Data Element that uses logic to choose which to use....

 

var realReferrer = _satellite.getVar('referrer'); var paramReferrer = _satellite.getVar('paramreferrer'); var finalReferrer = ''; // Check if the referrer is "IDP" AND there is a parameter query string, this also helps prevent "back" navigation to the url with the param to not "double track" the referrer if (realReferrer.indexOf('www.idplogin.com') > -1 && paramReferrer){ // if the passed referrer is not "none", then set the referrer to the passed value if (paramReferrer != "none"){ finalReferrer = paramReferrer; } // since the default value is already nothing, "none" should pass as empty } else { // If someone is logged in, and doesn't go through the IDP, this should pick up the real referrer finalReferrer = realReferrer; } return finalReferrer;

 

You can also add your IDP domain as an internal URL filter to make sure it doesn't show up in your referrers report.