as-ideas / oil

191 stars 56 forks source link

Questions regarding the oiljs purposes configuration #299

Closed kuflievskiy closed 3 years ago

kuflievskiy commented 4 years ago

Hello! We’re investigating oils and it's options of customization. I have 2 questions which I don't have answers to.

1) Is there the possibility to set the mandatory/required mark on some of the purpose items in order to show that this option is obligatory and a user can't unmark/disable it? I didn't find any setting in the oil.js configuration docs.

2) The second question is about the complete "purposes" override option. Oil.js doc says that it's "Fully configurable" https://oil.axelspringer.com/release/1.3.5/docs/index.html#features

If we want to set only 3 custom options in the "purposes" section instead of having the default settings we have after the initialization, should we use the "iabVendorListUrl" or "customVendorListUrl" options? Is it correct?

If I re-define all the settings using the "iabVendorListUrl", I could get what I actually want to see, but it looks like a workaround to me because not all the vendors are actually the "IAB vendors".

If I use "customVendorListUrl" to override the purposes, then I can't get rid of the error "Missing vendor list! Maybe vendor list retrieval has failed! Please contact web administrator!" and messages from 1 to 5 "Error: Missing text for purpose with id 5!"

I will really appreciate it if the community will help me to clarify those questions. Thank you in advance!

fabio-thoma commented 4 years ago

Hi,

  1. oil.js onboard - its not. But you can trigger the toggle for the purpose via javascript and disable it for the user. We've done this here: https://www.dkd.de/de/home/ JS:

    if (event && event.data && eventDataContains('oil_shown')) {
    var technicalNecessaryCookiesCheckbox = document.getElementById(
      'as-js-purpose-slider-1'
    );
    
    if (
      technicalNecessaryCookiesCheckbox === undefined ||
      technicalNecessaryCookiesCheckbox === null
    ) {
      return;
    }
    
    // Rename class for first slider button, so it won't bew affected by the activate/ deactivate all button
    technicalNecessaryCookiesCheckbox.className = 'as-oil-cpc_slider-disabled';
    // Add class for usage with custom CSS (see: Resources/Public/Stylesheets/oiljs_custom.css)
    technicalNecessaryCookiesCheckbox.parentElement.classList.add(
      'as-oil-cpc__switch-disabled'
    );
    // Activate the checkbox if it isn't
    if (!technicalNecessaryCookiesCheckbox.checked) {
      technicalNecessaryCookiesCheckbox.click();
    }
    // Disable checkbox for users
    technicalNecessaryCookiesCheckbox.disabled = true;
    }
  2. You have to use iabVendorListUrl, there you link to your own vendorlist.json. Example for three purposes:

{
    "vendorListVersion": 1,
    "lastUpdated": "2020-01-09T16:00:33Z",
    "purposes": [
        {
            "id": 1,
            "name": "technically necessary cookies",
            "description": "technically necessary cookies description."
        },
        {
            "id": 2,
            "name": "statistics and marketing",
            "description": "statistics and marketing description."
        },
        {
            "id": 3,
            "name": "videostreaming",
            "description": "videostreaming description."
        }
    ],
    "features": [],
    "vendors": []
}