Manual Script Blocking
Privacy regulations require user consent before processing. Indeed, the Cookie Law specifies that it's not possible to use/install a cookie before obtaining user consent, except for exempt categories of cookies (technical cookies). In this guide, we show you the steps to take to be compliant in this aspect as well, thanks to the functionality provided by our PubConsent CMP.
Currently, given browser limitations, we support and recommend the use of manual script blocking only.
For AMP environment, follow the instructions that you can find by clicking here
To adapt script, img, and iframe tags to enable the blocking of scripts that could install cookies, you need to make changes to these tags on the pages that install cookies. By making these changes, you'll enable our PubConsent CMP to prevent their execution in cases where consent has not yet been given and to check if the user has accepted a certain consent category if the enablement requirement is specified in the corresponding tag (script, img, and iframe).
To do this, apply the following modifications:
- Add the class "_js_pt_activate" to the script tags.
- Change the "type" attribute from "text/javascript" to "text/plain".
- Replace the "src" attribute with "data-suppressedsrc".
Per l’attivazione dei tag JavaScript inline occorre invece applicare la classe _js_pt_activate__inline.
*(1)
In case the type is module you can add a second attribute data-suppressedtype with module value
Some tag img and iframe could install cookies.
In those cases you have to:
- add the following class _js_pt_activate
- assign the original value of the attribute src to a new attribute data-suppressedsrc
- assign to the attribute src the following value: //cdn.pubtech.ai/pubconsent/empty.html.
Example:
To activate a script only if a category (or more) has been enabled by the visitor, you need to specify the attribute data-js-pt-categories as in the following example:
For readability purposes, we have changed data-js-pt-purposes to data-js-pt-categories In any case, both are supported.
The configuration applied in the example indicates to activate the script only if the category with id 2 and id 3 are enabled.
We remind you that the purposes are grouped into 5 categories (strictly necessary, interactions and basic functionality, enhanced experience, measurement, targeting and advertising), each identified by an id (1, 2, 3, 4, 5).
We remind you that specifying the attribute is optional for resources that fall only within category 1. Therefore, if not specified, they will be activated in any case.
- Strictly necessary (id 1). Purposes included: - Backup storage and management - Hosting and backend infrastructure - Management of landing pages and invitation pages - Platform and hosting services - Spam protection - Traffic optimization and distribution - Infrastructure monitoring - Payment management
- Interactions and simple functionalities (id 2). Purposes included: - User contact - Interaction with live chat platforms - Management of web conferences and online telephony - Handling support requests and contacts - Interaction with support and feedback platforms - Tag management - Registration and authentication - User database management
- Enhanced experience (id 3). Purposes included: - Commenting on content - Interaction with data collection platforms and other third parties - Display of content from external platforms - Interaction with social networks and external platforms - Interaction with online survey platforms - Management of RSS feeds - Social functionalities
- Measurement (id 4). Purposes included: - Statistics - Beta testing - Content and functionality performance testing (A/B testing) - Heat mapping and session recording - Data collection and online survey management
- Targeting and advertising (id 5). Purposes included: - Advertising - Advertising service infrastructure - Affiliate marketing - Contact management and messaging - Remarketing and behavioral targeting
In some cases, to properly activate a blocked tag, it's necessary to wait for the execution of a main script.
To manage dependencies correctly, two attributes are available:data-js-pt-wait-for and data-js-pt-label.
The attribute data-js-pt-label The first attribute should be used to identify the main script. The second attribute data-js-pt-wait-for The second attribute, instead, is used to identify the code that depends on the main script (using a unique code).
Here's an example: