How to check where your site visitors come from using javascript

Category : Deep Dive, JavaScript, Tips

Where do my visitors come from? That is always a question bloggers, site owners and advertisers want to know. Knowing who has referred the visitor to my site tells you a lot about that visitor. This information might help you drive better, more finely tuned content to this user.

Demo

Code


<script type="text/javascript">
        if(document.referrer){
           document.write("Hello, Thank you for arriving from: "
                                                   + document.referrer);
         }else{
           document.write("Hello,
                  Thank you for arriving directly to this page");
}
    </script>

This topic is covered in detailed in this interesting article.


Post a comment