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.

Share the love...Tweet about this on TwitterShare on LinkedInShare on Google+Share on Facebook

Amir Shevat

Amir Shevat is the global Startup Outreach lead in Google Developer Relations (g.co/launch). Previously, Amir Led Google Campus Tel Aviv and was the co founder of several startups.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *