Setting permission levels from your own code

Starting from BlueConic version 2.5 / Opt in - Opt out interaction version 1.0.2 it is possible to trigger the permission management selector or set a specific permission level from your own piece of JavaScript/HTML code, without having to rely on BlueConic generated dialogs. You can do so by publishing a permission management event. The example code below describes how.

Triggering the permission management selector

<script type="text/javascript"> 
    function triggerPMSelector() {
        if (window.blueConicClient) {
            window.blueConicClient.event.publish('optin_optout_openPermissionLevelSelector');
        }
    }
</script>

Setting the permission level

<script type="text/javascript"> 
    function setBCPermissionLevel(level) {
        if (window.blueConicClient) {
            window.blueConicClient.event.publish('optin_optout_setPermissionLevel',
                { permissionlevel : level });
        }
    }
</script>