Set ref by cookie.