How to check where your site visitors come from using javascript

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.

Leave a Reply