|
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.
|