Opt-in means asking the user for permission before using their personal data for marketing or other purposes. This method of getting the user’s permission is considered as more respectful of user’s privacy than opt-out.
For example, registering for an email newsletter is an example of opt-in, as you are giving permission for the company to include you in their mailing list.
Another example of opt-in, permission-based marketing is when you log in to a web site using your Facebook account. The app will ask you for permission to access your data, and you opt-in by proceeding with the log-in process. You also have the option to cancel in case you don’t wish to opt-in.