only add event listener if there is a cookie