If you know me, you know I love HitsLink. I’m not even paid to say that (hint to HitsLink!), as you’ll notice by the absence of any affiliate parameter in that link. My one big beef with them though is some of the tiny details they miss. They seem to have grown tremendously in the past year or so… Come on guys – take 20 minutes and add a little bit to your Implementation FAQ section!
So I have a site that, gasp, doesn’t use mod re-write to re-write the URLs. As such, without any modification HitsLink would just a page like http://www.example.com/page.asp?color=blue as simply “page.asp” in your reports. Gives you a rough idea, but now you have no idea if the red page is more popular than the blue, and so on. Previously the only way I knew around this was mod re-write the URLs to remove the variables, which isn’t a bad idea any way for many reasons. But sometimes technical limitations of the server (or the user) may make this not so practical. If you still want to have meaningful page stats in your HitsLink report what do you do?
I found this FAQ page which asks and answers “Can I track an ASP or PHP page that is generated dynamically?” The answer is yes, and then it gives two ways to do this depending on which version of script you are using. In this case I had the second version which has this variable in the script:
pageName=location.pathname;
…and it says to modify it like so, with ID simply being replaced by the parameter name you have tied to your page…
pageName=< %=request.querystring('ID')%>;
…but if you do this you’ll get this error:
Microsoft VBScript compilation error ‘800a03ea’
Syntax error
/directory/yourpagename.ext, line XX
Response.Write(request.querystring(‘yourvariable’))
The problem lies in the detail. You need to put ‘yourvariable’ in double quotes (“yourvariable”), so that line you modify should instead be:
pageName=< %=request.querystring("ID")%>;
Now I’m sure for most of the programmers out there this is a given, but to most of the rest of us who kinda learn the little bit of ASP or PHP or whatever other code that we need to learn and patchwork it together, this is not a given!
FYI – I’d recommend not simply making this change in your one script if you use a global include file for the script. Instead, I’d identify all the different types of dynamic pages you are not currently able to view and the parameter you’d like to use for each, and then you might end up with 3 or 4 different scripts. That is to say, you may have pagename.asp?color=blue and pagename.asp?color=red and then also another set of pages like services.asp?size=big and services.asp?size=small. You’d probably want to use two different scripts on each of those template pages.
Other HitsLink Posts: