I have a webpage and I want to show a special offer to visitors the 2nd time they visit my website like a special offer or things like that.

Can anyone help me out with a javascript code which sets a cookie to show my visitors a different snipit of html the 2nd or 3rd time they visit that webpage on my website?