Question Using a Referrer/UserAgent with WebBrowser

digitaldrew

Well-known member
Joined
Nov 10, 2012
Messages
167
Programming Experience
Beginner
Hey everyone, quick question... I'm trying to set a referrer in the webbrowser (either via referrer or useragent) but it doesn't appear to be working. I'm testing with Google Analytics and I can see my visit come in when I hit the homepage using the webbrowser, but it shows it as a "Direct" hit rather than the referrer I have set..

This is my code
VB.NET:
Me.wb.Navigate(lstURLs.SelectedItem, "", Nothing, "Referer: " & selectedReferrer & vbCrLf & "User-Agent: " & selectedUserAgent & vbCrLf)

Any idea what I could be doing wrong? Thanks!
 
Have you debugged what values those expressions actually evaluate to?
I tested this with valid strings for url/referer/agent and both referer/agent is detected correctly at these two urls:
Referer Test
Browser UserAgent Test
 
Hey John, thanks for your reply! I did debug to see what the values were and they appeared correct, although I noticed many of the useragents I was trying were extremely outdated. Could that have anything to do with it??
 
Could that have anything to do with it??
I don't know, maybe GA validates the referral, ie checks that there is a link to current url from given referrer.
 
Some sites also protect against referer spoofing through their own proxy. This will be true of any website that checks referer to determine if you just saw a paid ad. Not much you can do to go around those.
 
Back
Top