-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4efd02e
commit 6c811d5
Showing
7 changed files
with
102 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,115 @@ | ||
# TYPO3 Extension `klaro` | ||
|
||
Cookie consent solution using [klaro](https://klaro.kiprotect.com/) | ||
This is another cookie consent solution using [klaro](https://klaro.kiprotect.com/). | ||
|
||
Translations for the following languages are included: de, el, es, hr, hu, it, nl, pl, ro, sk, sl, sr. | ||
|
||
## Usage | ||
|
||
1. Install Extension, e.g. using `composer require studiomitte/klaro` | ||
2. Setup configuration in sites module | ||
3. Adopt configuration to your needs | ||
**1. Install extension** | ||
|
||
Use either composer `composer require studiomitte/klaro` or install the extension via Extension Manager. | ||
|
||
**2. Setup configuration in sites module** | ||
|
||
Switch to the sites module and configure the extension. All configurations are described below. | ||
|
||
**3. Adopt configuration to your needs** | ||
|
||
Copy one of the JavaScript files in `EXT:klaro/Resources/Public/Example/` to your theme extension (or fileadmin), adopt it to your needs and define the path to the file in the site configuration. | ||
|
||
## Configuration | ||
|
||
### Site Configuration | ||
|
||
The sites module is used for the main configuration. | ||
|
||
 | ||
|
||
The following options are available: | ||
|
||
- `Enable`: Enable the klaro cookie consent management | ||
- `Privacy Page ID`: Define the uid of the page with the privacy information | ||
- `Path to the configuration file`: Define the path to the JavaScript file containing the klaro configuration | ||
- `Path to the language file`: Use custom xlf files for localization. | ||
- `Show full consent modal`: If set, the consent modal is shown when the page is rendered, instead of a small modal in the bottom of the page. | ||
- `Style prefix`: Use a custom CSS. | ||
|
||
### Configuration | ||
### Klaro configuration | ||
|
||
See https://klaro.kiprotect.com/#getting-started, more later | ||
Klaro is using a JSON file for its configuration. An example: | ||
|
||
#### Inline code | ||
```js | ||
var klaroConfig = { | ||
cookieExpiresAfterDays: 365, | ||
default: true, | ||
mustConsent: false, | ||
|
||
apps: [ | ||
{ | ||
name: 'googleTagManager', | ||
title: 'Google Tag Manager', | ||
purposes: ['analytics'], | ||
required: true | ||
}, | ||
{ | ||
name: 'googleAnalytics', | ||
title: 'Google Analytics', | ||
purposes: ['analytics'], | ||
cookies: [/^ga/i], | ||
callback: function (consent, app) { | ||
if (consent !== false) { | ||
dataLayer.push({'event': 'loadgtm-analytics'}) | ||
} | ||
}, | ||
} | ||
], | ||
}; | ||
if (typeof klaroConfigTranslations !== 'undefined') { | ||
for (var attr in klaroConfigTranslations) { | ||
klaroConfig[attr] = klaroConfigTranslations[attr]; | ||
} | ||
} | ||
``` | ||
<!-- Google Tag Manager --> | ||
|
||
This example will load show 2 apps, **Google Tag Manager** which is always loaded and **Google Analytics**. | ||
The latter will be loaded by GTM and the callback must be used to actually load it only if the consent is given by the user. | ||
|
||
See https://klaro.kiprotect.com/#getting-started for all configuration options | ||
|
||
### Inline code | ||
|
||
To load inline code only after consent, use an example like below: | ||
|
||
```html | ||
<script type="opt-in" data-type="application/javascript" data-name="googleAnalytics">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
})(window,document,'script','dataLayer','###CODE###');</script> | ||
<!-- End Google Tag Manager --> | ||
})(window,document,'script','dataLayer','123456');</script> | ||
``` | ||
|
||
### Privacy Page | ||
The `src` attribute is changed to `data-src` and the attribute `data-name="googleAnalytics"` which correlates with the name of the app above. | ||
The JavaScript is then only evaluated if the consent is given. | ||
|
||
### Privacy Page | ||
|
||
It is required that users can change their consent. This is possible by linking to the following pseudo urls. | ||
|
||
Use the following pseudo-links | ||
|
||
- Consent Link: `https://KLARO_CONSENT.com` | ||
- Reset Link: `https://KLARO_RESET.com` | ||
- Open the consent modal: `https://KLARO_CONSENT.com` | ||
- Reset consent: `https://KLARO_RESET.com` | ||
|
||
The urls will be replaced dynamically by a JavaScript link which will then trigger the consent modal. | ||
|
||
### Styling | ||
|
||
If the configuration `Style prefix` is set, it is used as a prefix and you can apply your own CSS rules. | ||
The SCSS files in `EXT:klaro/Resources/Private/Scss/` should be copied to your frontend pipeline and modified to your needs. | ||
|
||
## Author | ||
|
||
This extension has been created by [StudioMitte](https://studiomitte.com) | ||
|
||
 |
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters