Guide: configuration of the cookie script (step 2)
Configuration of the cookie script can be customized in the config.php file. All possible settings and options are explained below.
2.1 Language of the cookie script
// Language of the script
$lang = 'nl';
- This setting can be used to make the script suitable for multiple languages.
- The language value must match the name of the file in the ‘lang’ folder. The ‘nl’ value calls the ‘nl.php’ file.
2.2 Maximum number of lines in log files
// Log files
$cookie_tool['max_log_lines'] = 100;
- You can also specify the maximum number of lines per log file. After the maximum number of log lines is reached, the cookie script will create a new log file. The log file contains the options saved by the users.
2.3 Store Google Analytics data in session
// Remember data for Google Analytics
$cookie_tool['remember'] = true;
- true: the script stores and remembers data for Google Analytics. In this way, the data is forwarded only after the user has accepted it.
- false: the script does not store or remember data for Google Analytics.
2.4 Enable or disable level 2
// Enable level 2?
$cookie_tool['level2'] = true;
- The cookie script standardly gives users the option to allow cookies on three levels (necessary cookies, functionalilty cookies and performance (recommended) cookies). It is possible to limit this to two levels. Level 2 is disabled. This can be used if you use only necessary and functionality cookies.
- true: enable level 2, in order to have 3 levels.
- false: enable level 2 , in order to use only two options.
2.5 Enable or disable automatically accept
// Accept after first page
$cookie_tool['auto_accept'] = true;
- The cookie script automatically accepts the cookies when the user navigates to the next page. If this option is not desired, it can be disabled.
- true:When a visitor visits a new page, he accepts the cookies.
- false:When a visitor visits a new page, the message remains visible and the cookies are only stored after they have been accepted.
2.6 Folder location
// Location of the cookie tool folder, with / at the end
$cookie_tool['prefix'] = 'cookie_tool/';
- Enter the complete location of the folder. In the example above the “cookie_tool” folder is in the root directory. If you place this folder in the “subdirectory”, then fill in here: [cc inline=”true” lang=”php” escaped=”true”]$cookie_tool[‘prefix’] = ‘subdirectory/cookie_tool/’;[/cc]
The texts used in the cookie tool are to be adjusted in the language files. The language files can be found in the ‘lang’ folder.
2.7 Appoint cookies for each level
// Different levels
array( 2 => // Level 2
array('do' => // Describe the installed cookies
'Install necessary cookies (remember basic settings)
Tracking statistics: [insert_data]
Allow sharing page(s) via social media')
- You can indicate which cookies are allowed to be used on each level(do). Three different cookies are added in the example above. The stored variables are displayed in the place of
, 'dont' => // Describe the cookies that are not stored
explode("\n", 'Using visitor information for relevant ads')
- Each level should specify which cookies must not be stored. In the example above there will be no visitor information used for relevant ads.
- Please note that each level should indicate which cookies may and may not be used.
2.8 Define the GET’s (not necessary to adjust)
// Define the $_GET's that have to be stored in a session and that need to be displayed after acceptance (in the URL)
$cookie_tool['check'] = array('utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_campaign', 'gclid');
- The script can store specific variables from the URL in a session and offer feedback after the cookies have been accepted. In this way, data can still be forwarded to Google Analytics. Specify in this rule the different variables which must be stored.
$cookie_tool['check_name'] = array('Source', 'Medium', 'Term', 'Content', 'Campaign', 'GCLID');
- Then specify how these variables should be listed in the pop-up. This is therefore the description of the variables. The different variables will be displayed on the spot where [cc inline=”true” lang=”php” escaped=”true”][insert_data][/cc] is located.
2.9 Texts for the small pop-up
// Small pop-up
$cookie_tool['small_popup_header'] = 'Cookie settings';
- The title of the small pop-up. This is the pop-up that appears after your website is visited (the big pop-up contains a summary of the choices (two or three levels) from which the customer can choose from).
- The text in the small pop-up. In this pop-up you can give a short and clear explanation about which cookies will be stored if the user directly accepts the cookies.
$cookie_tool['small_popup_button'] = 'Accept';
- The text in the accept button
$cookie_tool['small_popup_link'] = 'Settings';
- The link to the pop-up settings.
2.10 Texts for the pop-up settings
// Pop-up settings
$cookie_tool['large_popup_header'] = 'Cookie settings';
- You can modify the title of the pop-up settings here.
$cookie_tool['large_popup_text'] = '<p>Cookies are used on adresults.com. A cookie is a small text file stored on your PC. This file keeps track of data regarding the visited pages and contains some information about your visit. Cookies are also used for different features on our website such as the ability to share pages within social media (Google+, Facebook, Twitter, etc.). The cookies are stored locally on your own PC and contain only anonymous information.</p>
- You can change the explanation at the top of the pop-up settings. By default the same text is set as on this website. Make sure you customize it to your own text and refer to a page within your website where you clearly explain the cookie usage for the visitors.
$cookie_tool['large_popop_choise_header'] = 'Desired cookie settings';
- You can change the title above the different levels.
$cookie_tool['large_popup_button'] = 'Save';
- You can change the text on the green button to save the settings.
$cookie_tool['do'] = 'The website will:';
$cookie_tool['dont'] = 'The website will not:';
- The text that will and will not be inserted above the cookies.
$cookie_tool['level_names'] = array('Recommended', 'Functionality', 'Necessary');
- The different level names.
$cookie_tool['label'] = 'Recommended';
- There is a text with “recommended” above level 3, you can change this text.
Go to step 3: integration of the cookie script