Features
OptInOut helps you handling the opt-in and opt-out processes on your website or in your web-app.
The core-library is a JavaScript library (optinout.js) which handles everything client-side. We also provide you with solutions for checking & storing data server-side as well as prebuilt solutions for WordPress (coming soon) etc.
Simple Setup
Simple Setup
Our default settings provide you with an out-of-the-box working configuration. You just need to setup the services/scripts you want to handle.
Google Tag Manager Ready
Google Tag Manager Ready
If you're already using GTM for managing Scripts & Tags you can easily include optinout.js in GTM and use all conditions and triggers functionality for easier handling.
Extendable
Extendable
The storage-system uses a documented API. So you can build your own storage adapters if needed. Our plugin-api also allows you to register for events and handle them.
Sweet Extras
Sweet Extras
We want to help you manage user consent. Therefore we provide you snippets (e.g. storing optin-data server side) as well as solutions for important platforms (WordPress Plugin coming soon).
Quick Start
Install
You can download the latest release here. This includes the src & dist directory.
There's also a npm package.
Load
Static HTML
For usage in standard websites with best browser coverage we recommend including the dist/optinout.js
or dist/optinout.min.js
.
Just include the script via a standard script-tag in the header/footer:
<script src="path/to/optinout.js" ></script>
Usage
Initialization
You have to initialize the library before using any of its methods:
OptInOut();
This initializes the library with our default options & storages. Even if you do not want to customize the options you have to add your services:
OptInOut({
services: {
'facebook': {
mode: 'optIn',
},
'analytics': {
mode: 'optOut',
},
},
});
Opt-In & Opt-Out
You can use the global's object "static" methods for quick access to the most important methods of the current instance.
//opting out
OptInOut.optOut('analytics');
//opting in
OptInOut.optIn('facebook');
For easier handling we include a link-helper plugin, which automatically trigger when buttons with specific classes are clicked. Add it as a plugin with OptInOut.plugins.linkPlugin
on initialization and add the optInOut-optIn
class and the data-service
-attribute to your buttons. See full documentation for details.
Checking Status
Checking if something is allowed or not (--> if the user has opted in/opted out) is easy:
OptInOut.isAllowed('facebook');
This method takes the current saved status & the mode of the service into consideration.
If you want to show the current status as a string (e.g. on a privacy page together with the link to opt out) you can use the getStatus
method:
OptInOut.getStatus('facebook');
This method returns the string specified in the language options (see full documentation).
Try it Out
This interative example is based on the quick start guide above. We additionally added a debug-plugin, used the link-plugin and added buttons for resetting data
Analytics
Debug Info
Debug Info
Debugging-Output comes here
Support & Contributing
Support
Support
If you have any problems with OptInOut or need help setting it up you can use our Documentation, the issue system or just shoot us an e-mail.
Please understand that this is an open-source project and we do not offer any advanced support.
Bugs
Bugs
If you fund a bug please use our issue system for reporting it. Of course we'd love if you like to help and send a merge request
Contribute
Contribute
Contributors are always welcome. Just use the issue system to request features and maybe even send a merge request.