Skip to content

Commit

Permalink
Add reStructuredText documentation (#40)
Browse files Browse the repository at this point in the history
Thank you @sebkln!
  • Loading branch information
sebkln authored and Jonas Eberle committed Nov 28, 2019
1 parent 617fc9c commit c534d1d
Show file tree
Hide file tree
Showing 14 changed files with 1,403 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Documentation/Configuration/CookieUsage/Index.rst
@@ -0,0 +1,31 @@
.. include:: ../../Includes.txt


.. _configuration:

================
Usage of cookies
================

Target group: **Developers, Integrators**


Find out which tracking objects are used
========================================

You can check your page with an empty cookie storage with your browser and see which cookies gets inserted in your browser.
Or you can use a service like `Cookieservice <https://www.cookieserve.com/>`__ to fetch a page or sign up for services that
crawl your whole site regularly for cookies.

There might be connections made to external servers to access tracking pixels or other content that warrant a user consent, too.
This applies to YouTube (use youtube-nocookie.com) and :abbr:`CDNs (Content Delivery Networks)` (Google Fonts, Bootstrap and
other frontend libraries - recommendation: do not use external connections at all if not necessary).

Also other means for tracking might be used, like HTML5 Web Storage (localStorage).
It is a task for the official Data Security Officer of the site to decide what needs to be consented.
If done correctly, you should be able to find a note about used tracking services in the Data Privacy Statement of the website.

If you have control over how the tracking object is inserted you can have *Cookieman* handle that for you.
Otherwise you can make the actual inclusion of the tracking object dependent on a *Cookieman*-API-call or a presence of a
certain string in *Cookieman*'s cookie "CookieConsent" - this is recommended if you are managing several tags with
Google Tag Manager (set its trigger to "cookie ‹CookieConsent› contains ‹group name, e.g. "marketing"›).
76 changes: 76 additions & 0 deletions Documentation/Configuration/Customization/Index.rst
@@ -0,0 +1,76 @@
.. include:: ../../Includes.txt


.. _customization:

=============
Custom themes
=============

Target group: **Developers, Integrators**


Create a new theme or adapt an existing one
===========================================

.. note::

We are happy to receive pull-requests for new themes!


This is a recommendation how to set up your template structure for a custom extension.

1. Set your base path in TypoScript constants:

.. code-block:: typoscript
plugin.tx_cookieman.settings.resourcesBasePath = EXT:your_ext/Extensions/cookieman/Resources
2. Choose a new theme name:

.. code-block:: typoscript
plugin.tx_cookieman.settings.theme = myTheme
3. Create folder `EXT:your_ext/Extensions/cookieman/Resources/Private/Themes/myTheme/`.
Add 3 folders: `Templates`, `Partials`, `Layouts`.

4. These folders will have the highest priority when looking for templates, partials or layouts now.
The fallback will be `EXT:cookieman/Resources/Private/*`.

5. Create folder `EXT:your_ext/Extensions/cookieman/Resources/Public/Themes/myTheme`. This will hold the files `cookieman-theme(.min).css` and `cookieman-theme(.min).js`. Reimplement the methods cookieman.show() and cookieman.hide() in `cookieman-theme(.min).js`.

6. Copy the .css, .js and .html files as needed from a default theme.

7. Adapt the HTML/CSS/JS as needed.


Storing user consent
====================

These **HTML element attributes** control the functionality:

<* data-cookieman-save>
^^^^^^^^^^^^^^^^^^^^^^^

Save and close


<* data-cookieman-accept-all>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Mark all checkboxes

They can appear multiple times and also together on the same element.

Example:

.. code-block:: HTML

<button rel="nofollow" class="btn btn-primary"
data-cookieman-accept-all
data-cookieman-save>
{f:translate(key: 'accept')}
</button>
99 changes: 99 additions & 0 deletions Documentation/Configuration/Example/Index.rst
@@ -0,0 +1,99 @@
.. include:: ../../Includes.txt


.. _configuration-example:

=====================
Configuration example
=====================

Target group: **Developers, Integrators**


Example
=======

This example configuration is based on the base TypoScript configuration
(see :ref:`installation-steps`) without the example template.

.. code-block:: typoscript
temp.tx_cookieman.settings.groups.mandatory < plugin.tx_cookieman.settings.groups.mandatory
plugin.tx_cookieman.settings {
trackingObjects {
# extend the existing configuration for 'Matomo'
Matomo {
inject (
<script type="text/javascript">
var _paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//my-piwik-server.my-domain.com/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', 'my site ID']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
)
}
# add my own custom tracking solution
# if you have a useful configuration and want to share, we would be happy if you did a pull request!
MyOwnTrackingPixel {
inject (
<div>Here be dragons <img src="https://via.placeholder.com/200x200?text=Tracking pixel..."></div>
<script>alert('oh la la!')</script>
)
show {
# each element here represents one line of information in the consent popup
pixelphp {
duration = 1
durationUnit = months
type = pixel
provider = My Website Inc.
}
}
}
}
# reset existing groups
groups >
groups {
# copy of default group 'mandatory'
mandatory < temp.tx_cookieman.settings.groups.mandatory
# my new group
mygroup {
trackingObjects {
0 = Matomo
1 = MyOwnTrackingPixel
}
}
}
}
plugin.tx_cookieman._LOCAL_LANG {
en {
trackingobject.pixelphp = You can translate the name, but you do not have to.
trackingobject.pixelphp.desc = My own tracking pixel does not really track you. It's just here to cheer you up.
group.mygroup = My group is my castle.
type.pixel = Tracking pixel
}
default < .en
}
Make the consent revokable
==========================

It is recommended to include a snippet like the following on your data privacy statement page
to allow your users to adjust their cookie preferences:

.. code-block:: HTML

<button onclick="cookieman.show(); return false">
Adjust your cookie preferences
</button>
28 changes: 28 additions & 0 deletions Documentation/Configuration/Index.rst
@@ -0,0 +1,28 @@
.. include:: ../Includes.txt


.. _configuration:

=============
Configuration
=============

Target group: **Developers, Integrators**

This extension comes with two static templates:

* `Cookieman` contains the basic and necessary configuration. Use this and extend the settings to your needs.

* `Cookieman (Example configuration of groups and tracking objects)` can be included additionally to get
a full example with multiple groups and tracking objects.

Learn how to configure Cookieman:

.. toctree::
:maxdepth: 3
:titlesonly:

CookieUsage/Index
Example/Index
Reference/Index
Customization/Index

0 comments on commit c534d1d

Please sign in to comment.