checking visited cookie before writing to db.