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 1) PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Seo Master   
Thursday, 13 September 2007
Image As you already know, HitLens tracks visitor activity with the help of a special tracking code (written in JavaScript) which is inserted into your HTML pages. It reports certain data when a visitor opens a page in his / her browser. If the site is static, the script will be simple because every time the page is requested, the script sends one and the same set of data to the tracking database.

However many websites are built using a dynamic technology. It means that a visitor can request the same page but will see a different result in return, depending on the parameters the page is requested with.

For instance, visitors are shown a catalog where they can choose between an LG Monitor, a Sony Monitor or a Philips Monitor. They make the choice and click the link "buy now". All three "buy now" links point to the same "thank_you.php" file. The page "thank_you.php" contains the script which is executed on the server before sending the result back to the visitor. This script registers the transaction and, depending on the visitor's choice, displays a thank-you message to the visitor, "Thank you for purchasing this wonderful Philips Monitor".

Most often, dynamic technology is used on commerce websites with shopping carts and product databases.

The HitLens tracking script gives you the ability to get as much detail about every transaction as possible (order, subscription, trial, download, any action the visitor completes on your website). However, you will need to tune the HitLens tracking script and integrate it into your existing dynamic page in order to receive precise and thorough reports which will give you enough data for analysis.

How the tracking works

When someone visits your page, the tracking script on the page transfers certain data to the Seo Software, where these data are registered in the stats database. The information passed to the Datacenter is stored in the variables of the tracking JavaScript, e.g.:

var PAGENAME = escape('mypage.htm');

This line tells the Datacenter that the visitor has opened the page named "mypage.htm". The variables named TRANSACTION, TRANSACTION_ID, and ORDER work the same way: they store the details of the visitor's action (order, subscription, etc) which resulted in displaying this page to the visitor, and transfer these details to the Seo Software for registration in the HitLens database.

If your website is database-driven and / or uses some dynamic technology to generate this information (e.g. PHP or ASP server-side scripts), then this data, once generated, must be passed from your server-side script to the JavaScript.

In the following example, PHP gets the ID of the transaction just completed from a MySQL database after an INSERT query has been completed:

$transaction_id = mysql_insert_id();

From this moment, the PHP (script which is executed on the server to register the transaction) variable $transaction_id stores the ID of the transaction the visitor has accomplished on your site.

Next, you will want to pass this transaction ID to the HitLens tracking script so that this transaction can be registered by the HitLens statistic service. As you remember, HitLens scripts are executed on the browser side. So you paste the HitLens tracking script into this PHP page and populate its variable with the value of the PHP variable "$transaction_id":

var TRANSACTION_ID = escape('<?php echo $transaction_id; ?>');

Note that the tracking script must be outside your server-side code, although they both still remain within the same file. For instance, a PHP script is usually delimited from the rest of the code by the marks "<?php" in the beginning and "?>" in the end, so the HitLens tracking script must be inserted after the final enclosing "?>" marker.

Now let's walk through the tracking setup process step-by-step with the help of an example. For better understanding, scripts processed on server are marked red and the ones sent to user's browser and executed there are marked blue.

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…