Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tracking 1

Status
Not open for further replies.

mcode12

Programmer
Aug 8, 2007
25
GB
I'd like to track the keywords that a searcher has used to arrive at my site and then made a payment through PayPal.
I'd like to track this with PayPal's custom field.

For instance

'Get site referrer
sSite=Request.QueryString("HTTP_REFERRER")
'if referrer is google then create a cookie
If InStr(Lcase(sSite),"google") Then
Response.Cookies("siteRefferal")="Google"
Response.Cookies("siteRefferal").Expires=Now+365
End If

'check referrer
If Request.Cookies("siteRefferal")="Google"
'set PayPal's custom field to google
End If

Assuming the code is alright how could I attach the specific keywords as well?

Thanks.
 
Try looking for the HTTP_REFERER in ServerVariables instead of QueryString.

Note the spelling.
 
sorry my mistake, but is there a way to fetch and track the keywords?
 
I just searched google for: secret words

The google results page had the following URL:[tt]
[/tt]

Page 2 of results had this URL:[tt]
[/tt]

Page 3 had this:[tt]
[/tt]


So I would assume if I clicked on one of the actual search results, my browser would send an HTTP request to the listed URL and along with the request, my browser would also send the URL of the google result page in a field named HTTP_REFERER.

So, I assume, that although the URL in HTTP_REFERER has a QueryString of its own, I would NOT be able to parse it using the Request.QueryString colletion, because that particular QueryString would be the QueryString of the google result link rather than the one from the google result page on which the link appeared.

So I assume you'll need to use the string parsing functions like InStr() and Mid() to extract the meaningful query data from the HTTP_REFERER.

I also assume that different search engines will use different techniques so you'd need different logic to process them.
 
Well that's what I thought but I don't get anything in the HTTP_REFERRER ServerVariable
 
Mind you, the term that means "One who refers" SHOULD be spelled "referrer", but apparently that fact eluded the people who wrote the HTTP specification ;-)
 
Keep in mind, there are some browsers that allow a user to turn off the referrer reporting. I believe firefox has that capability. For those users, you will not be able to track their referrer values.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top