Our Network: Proxy Directory NEW! Top Sites Learn SEO eBusiness solutions Proxy Browsing NEW! Anonymous Surfing Shrink your link! NEW!
 Submit new Articles
Setting Up Visitor Tracking for a Dynamic Site (part 3) PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Seo Master   
Friday, 14 September 2007

Image ASP Example

Step 1. Open the result page source code and populate variables

Let's assume you offer your visitors a computer monitor "LG" worth $999.99. When a visitor clicks the 'order now' link, some ASP page is called, e.g. "thank_you.asp". This page contains the server-side script that handles the transaction and displays a thank-you message.

Here's a sample code which your "thank_you.asp" might contain:

Here's a sample code which your "thank_you.asp" might contain:

<%

'(Here goes your code to handle the transaction)

Let's make ASP store the name and the content group of the page displayed. This is how the visit to this page will be later seen in the HitLens reports.

Dim pagename, contentgroup

pagename = "LG monitor thank-you-page"

contentgroup = "TFT Monitors"

Now let's make ASP store the transaction details. By "transaction" we mean any act that can be accomplished by your site visitors and requires a dynamic processing: an order, a subscription, a download or a sign-up all are transactions.

Dim transaction

transaction = "Orders"

Your processing system probably assigns a certain number to each order / transaction. You can pass this number to the HitLens script. Each transaction ID must be unique. For instance, you may use the Auto number / Auto increment field value supported by most databases. In other words, it's a unique order number generated by your shopping cart software or database. If not applicable, you may put 0 (zero).

Dim transaction_id

transaction_id = rsAddedRecord.Fields("id").value 'or: transaction_id = 0

Note that this code is just a sample and in real life you might use completely different ways and sources of this number.

Now we capture the order details into ASP variables. HitLens is able to track 4 parameters for each order: product name, category, quantity and order amount. If a certain parameter is not applicable or unavailable, replace it with a hyphen or simply leave it blank, e.g. order_category = ""

Dim order_product, order_category, order_quantity, order_amount

Dim order_details

order_product = "LG monitor"

order_category = "TFT Monitors"

In the variable 'quantity' you can pass numeric values as well as strings:

order_quantity = 1 'or: order_quantity = "1 piece"

order_amount = 999.99

Let's organize the order details into one single variable, separated by commas.

order_details = order_product & "," & order_category & "," & order_quantity & "," & order_amount

Note: if your page serves several orders, you may pass them all in one variable, separating different orders with a semicolon:

order_details = order_product1 & "," & order_category1 & "," & order_quantity1 & "," & order_amount1 & ";" & order_product2 & "," & order_category2 & "," & order_quantity2 & "," & order_amount2

Do not change the order of parameters. The amount may not exceed one billion (the max amount is 999999999.99) and should not be delimited by commas (only dots). Do not pass currency signs ($, €) in the amount parameter.

So now the ASP variable order_details contains the following string:

"LG Monitor, TFT Monitors, 1, 999.99"

%>

That's all we needed to do on the server side for tracking. Here's the complete code:

<%

Dim pagename, contentgroup

pagename = "LG monitor thank-you-page"

contentgroup = "TFT Monitors"

Dim transaction

transaction = "Orders"

Dim transaction_id

transaction_id = rsAddedRecord.Fields("id").value

Dim order_product, order_category, order_quantity, order_amount

Dim order_details

order_product = "LG monitor"

order_category = "TFT Monitors"

order_quantity = 1

order_amount = 999.99

order_details = order_product & "," & order_category & "," & order_quantity & "," & order_amount

%>

Step 2. Insert the tracking code

The ASP script from the previous step is executed on the server when your visitor initiates an action on your site. The hosting server then sends the result to the visitor. If you want to implement HitLens tracking, you also need to make the server send the tracking code to the visitor. This code will be executed in his / her browser and report the visit details to the Seo Software's Database.

For correct reporting, this tracking script must be populated with our variables we have just created, before being sent to the visitor.

So we paste the HitLens tracking script into our ASP page after the ASP code itself, however, we use several fragments of ASP code in the HitLens tracking script in order to pass the information collected to the variables of the HitLens script.

After the closing marker of the ASP code "%>" goes the beginning of the tracking code:

<!--WEBSITE:BEGIN:{764EEF2E-BC11-45CF-8627-300CE1BA2219}-->

<!--

Do NOT modify this script to avoid traffic misrepresentation!

Web 4 0300/1

Code initially inserted into: “thank_you.asp".

-->

<script type="text/javascript"><!--

// hitlens v1.2.7

function hitlens_embedded() {

Then, we pass the site ID and page ID (pc) to the script. The site ID can be found in Project Manager opposite to the given website and under the HitLens column, for example, 123456.

The pc variable should be 0 (zero), if you use specialized tracking instead of standard wizard-driven setup (as is the case for us).

var id = 123456;

var pc = 0;

The PAGENAME variable stores the user-friendly name under which this page will appear in the HitLens reports. Earlier we initialized the ASP variable pagename with the value "LG monitor thank-you-page". Now we make ASP pass this value to HitLens:

var PAGENAME = escape(' <% response.write(pagename) %> ');

As a result, after the ASP page is executed, the visitor's browser receives the following:

var PAGENAME = escape('LG monitor thank-you-page');

Now HitLens knows that the visitor has opened the page "LG monitor thank-you-page" and will report it to the Datacenter.

The same happens to the content group. Earlier we have assigned the value "TFT Monitors" to the variable contentgroup. Now we pass it to the HitLens script.

var CONTENTGROUP = escape(' <% response.write(contentgroup) %> ');

The variable "TRANSACTION" stores the type of the transaction: it may be sales, trials, subscriptions, downloads, or anything you choose:

var TRANSACTION = escape(' <% response.write(transaction) %> ');

In our case it will be "Orders", because earlier we assigned this value to transaction.

The same happens to transaction ID and order:

var TRANSACTION_ID = escape(' <% response.write(transaction_id) %> ');

var ORDER = escape(' <% response.write(order_details) %> ');

As you remember, the variable "order_details" lets HitLens know the order details:

"LG Monitor, TFT Monitors, 1, 999.99"

After that, you may safely insert the ending of the HitLens tracking code:

return "id="+id+"&pc="+pc+"&p="+PAGENAME+"&gr="+CONTENTGROUP+"&tr=

"+TRANSACTION+"&trid="+TRANSACTION_ID+"&ord="+ORDER;

}

//--></script>

<script type="text/javascript" src="/tracking.js"></script>

<!--WEBSITE:END:{764EEF2E-BC11-45CF-8627-300CE1BA2219}-->

So here's the entire sample tracking script:

<!--WEBSITE:BEGIN:{764EEF2E-BC11-45CF-8627-300CE1BA2219}-->

<!--

Do NOT modify this script to avoid traffic misrepresentation!

Web 4 0300/1

Code initially inserted into: “thank_you.php".

-->

<script type="text/javascript"><!--

// hitlens v1.2.7

function hitlens_embedded() {

var id = 123456;

var pc = 0;

var PAGENAME = escape(' <% response.write(pagename) %> ');

var CONTENTGROUP = escape(' <% response.write(contentgroup) %> ');

var TRANSACTION = escape(' <% response.write(transaction) %> ');

var TRANSACTION_ID = escape(' <% response.write(transaction_id) %> ');

var ORDER = escape(' <% response.write(order_details) %> ');

return "id="+id+"&pc="+pc+"&p="+PAGENAME+"&gr="+CONTENTGROUP+"&tr=

"+TRANSACTION+"&trid="+TRANSACTION_ID+"&ord="+ORDER;

}

//--></script>

<script type="text/javascript" src="/tracking.js"></script>

<!--WEBSITE:END:{764EEF2E-BC11-45CF-8627-300CE1BA2219}-->

 

Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

security code
Write the displayed characters


busy
 

Ads

Polls

Where did your hear about WebUniver?
 

Who's Online

Image

Learn to Fail to be Successful in Making Money Online

28.08.2007 | Business

Being successful online is part of all bloggers dream and to be successful in making money online, you need to fail to gain experiences and learn from your mistakes so that it will not repeat its history. Many people do not understand the word "Failure" and once they fail…

Auditing and Improving Your Site

22.10.2007 | Marketing

You may ask yourself why we include material on site maintenance in a course that deals mainly with search engine optimization, promotion, and marketing – isn’t this the job of the webmaster or site administrator?Remember the Integrated Approach considers site quality maintenance a secondary yet obligatory addition to your promotion…

Image

What Are The Pros And Cons Of Using Flash Sites

22.08.2007 | Design & Development

Flash - based sites have been a craze since the past few years, and as Macromedia compiles more and and great features pursuit Flash, we can only predict practiced will exemplify more and more flash sites around the Internet. However, Flash based sites have been disputed to be bloated…