We offer free DNS hosting and
    management for:
  • ✔ AC.UK domains
  • ✔ GOV.UK domains
  •  
    Contact us now...

Tracking which pages your customers have viewed.

The tracking of pages viewed by a new customer can be invaluable to marketing your web site.  You could be wasting your efforts on pages which your customers are not viewing.   It is very easy to trace the pages a new customer has viewed using a simple cookie (*there are other methods of tracing a customer through your site, e.g. using PHP sessions, this tips and tricks exercise uses JavaScript).

You should be able to implement the following within minutes and with only a knowledge of HTML and a little JavaScript.

There are two parts:  1.  The JavaScript to add to all the pages which you wish to monitor, and 2. The JavaScript and HTML to add to your "join" or "order" page.

1. Monitor a page - can be used on ALL pages

JavaScript to save a cookie:

Copy the whole of the script above and paste into the pages you wish to monitor (obviously starting with your homepage - index.html). 

2. Collect the data from the cookie - used on your join/order page

JavaScript to collect the data from the cookie:

Copy the whole of the script above and paste into the END of your join/order page.  You must add a hidden field on your join/order page, e.g:

...<form ACTION="MyPHPfile.php" METHOD="POST" NAME="joinform">
<input type="hidden" name="pages_viewed" value="">....

And ensure you change the form name: joinform to your own form name within the JavaScript above before trying to use it.

As usual we have provided a working solution that will suffice for most, but some will wish to refine the functionality.  Such as incrementing the variables r_hits and p_hits as a particular page receives multiple hits from that same visitor.  If you need to improve your knowledge of JavaScript then to enhance this simple script in this manner is an excellent exercise.

You should ensure that you have the correct privacy policy if you intend to implement these tracking scripts, e.g. view the last bullet point of our privacy policy here:  http://www.seiretto.com/privacypolicy.php

*There are pros and cons for both methods, using PHP sessions will save far too much data that can be rendered useless in most cases.  The most useful data is from those that actually make an order, using sessions would mean recording ALL visitor hits.  Using this example if a visitor returns to the site several days later recordings of previous viewed pages should be intact (unless the user has cleared the cookies on the browser or is using a different PC).  From our experience new customers will browse a site before ordering and bookmark the homepage then return days, weeks or sometimes months later to order.  Given this scenario the PHP session method is useless and our JavaScript method should suffice for most web sites.   We hope you find it useful.  Please send us your comments, follow the contact us link below.




^back to top^

Copyright © 1996-2017 Seiretto Ltd. All rights reserved.
Registered in England & Wales no: 4716409. VAT no: GB780 4245 32