Forum Moderators: DixonJones

Message Too Old, No Replies

My Tracking Code Doesn't Always Work

Seems Simple / Can someone take a peek?

         

PRNightmare

7:47 pm on Apr 10, 2003 (gmt 0)

10+ Year Member



I came up with a simple method of tracking who bought/converted what from which PPC campaign. The cool part is that it pulls the information from the URL when they enter any page of the site, which includes which campaign, the keyphrase and referring URL. Here is the code...
BEGIN CODE ---------------------->
If Request.Cookies("mysite")("refhost") = "" Then

<<This is where a basic URL strip code snippet is usually insterted>>

Response.Cookies("mysite")("refhost") = GetHost(Request.ServerVariables("HTTP_REFERER"))
Response.Cookies("mysite")("source") = Request.QueryString("source")
Response.Cookies("mysite")("query") = Request.QueryString("q")
Response.Cookies("mysite").Expires = Date + 3
End If
END CODE ------------------------>

Then I extract the variables from the cookie and write that to the database when they convert.

Sometimes I get this...

Host: search.msn.com
Campaign: overture
Keyphrase: my special phrase

and, sometimes I get this...

Host: mydomainname.com <---- "This is my site domain"
Campaign:
Keyphrase:

and, sometimes I get this...

Host:
Campaign:
Keyphrase:

Any idea what is going on here? I have watched a few customers convert through a PPC, but wasn't able to grab the variables. They have to have cookies enabled to even buy anything, so I think the cookie is being written.

jeremy goodrich

7:19 pm on Apr 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps another ASP coder could give you a hand with that?

My tracking scripts are written in a combo of javascript & Perl, javascript calls the server & then the perl script logs the stuff, etc.

Sounds like you have a good thing started there though, knowing how a purchase was made online is crucial to the next level of success in any market.

MrSpeed

8:44 pm on Apr 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can't the second two be from type in traffic?

Also are you always writing to the db even if there is not a cookie? Might want to try..
If Request.Cookies("mysite")("refhost") <> "" Then
write to the DB
End If

You may also want to have a few lines that detects if they can accept cookies. There is a good article at asp101. search for "cookie detection". The author makes note of a trailing? problem. Never heard of that one before.

You may need to set the domain if you running on a server farm as well.

Just some thoughts.