added opt in and opt out into javascript