Forum Moderators: open

Message Too Old, No Replies

how to collect all the string

         

stevelibby

12:53 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



hi,
i am currently devoping a simple enough click tracking string, however as usual i have run into a brick wall, with my knowledge of ASP hard coding not being the greatest i wonder if you can help here.
Here is the issue:
from the page i want to track each link has a /url=bla&cat=bla
from her it links to a redirect page and send the browser to the url.
It work just fine, until the url has a "&" in it, like an affiliate link would have. therefore the the full url does not get carried across?
how can i get the full url?

mrMister

3:16 pm on Aug 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure what you're trying to do. Perhaps you could paste some of your code.

Does /url=bla&cat=bla work?

emsaw

4:17 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



stevelibby,

classic ASP, right?

You need to look at the querystring in the servervariables collection. This is a sample that will just mirror the url typed in to access the url it is accessed at:


<%@ Language="VBScript" %>
<% Option Explicit %>
<%
Dim svKey, sv, sName, qString, fullURI, secure, hostName
Set sv = Request.ServerVariables
sName = sv("SCRIPT_NAME")
qString = sv("QUERY_STRING")
hostName = sv("SERVER_NAME")
If( sv("SERVER_PORT_SECURE") = 1) Then
secure = "https://"
Else
secure = "http://"
End If
fullURI = secure & hostName & sName
If(Len(qString) > 0) Then
fullURI = fullURI & "?" & qString
End If
Response.Write fullURI
%>

HTH,
-Mark

stevelibby

4:44 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



thank you
lets back pedal here look at this link [developersdomain.com...] , you will see a script for clicktracking, this works great until i have to enter an affiliate link that is a 2 part link.!

emsaw

2:59 am on Aug 31, 2005 (gmt 0)

10+ Year Member



Stevelibby,

Sorry, I think I misunderstood your original request/question.

If you are trying to put an affiliate link with a querystring into the 'URL' querystring parameter of an existing url, then you will need to Server.URLEncode()
the 'affiliate link' you wish to redirect to.

so you would Server.URLEncode something.. say
[widgets.com...]

then the tracking link would be something like:
"/Track.asp?" & Server.URLEncode(url) & "&cat=789"

and this would turn out to be:
"/Track.asp?http%3a%2f%2fwww.example.com%2flandingPage.aspx%3fAffiliateID%3d123%26CategoryID%3d456&cat=789"

Make sense?

Mark

[edited by: Xoc at 12:13 am (utc) on Oct. 27, 2005]
[edit reason] changed to use example.com [/edit]