Implement in the source code

To implement the Consent Pop-up in the source code, insert the script as high in the website's <head> tag in the HTML code as possible.

<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="EN" type="text/javascript"></script>

Sample implementation

Consent_Pop-up_Sample_implementation.png

Selecting language

The data-culture="EN" is used to control the languages (in this case it is calling the English language). To change the language, set the data-culture attribute to a different language code using the table below. Please make sure that the selected languages are enabled in the “Languages and Settings” under the specific consent solution in the Cookie Information Platform.

Setting the language in your CMS

When using either the pop-up script or policy-script the way you define which language to pull from the Consent Solution is by entering a two-letter ISO language code in the data-culture attribute on the scripts. By using server-side code, like PHP or asp .NET you should be able to store a dynamic language code, pulled from the CMS or the language-plugin of your choice, in a variable to be used in the data-culture attribute.

Example from WordPress

<?php $languageCode = substr(get_locale(), 0, 2 ); ?>
<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="<?php echo $languageCode; ?>" type="text/javascript"></script>

Example from Joomla:

<?php $lang = JFactory::getLanguage(); $languages = JLanguageHelper::getLanguages('lang_code'); $languageCode = $languages[$lang->getTag()]->sef;?>
<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="<?php echo $languageCode ?>" type="text/javascript"></script>

The examples above are based on a PHP created CMS and will differ from other server-side frameworks. We suggest you consult with your agency or developer on how it would work on your CMS.

Language Codes

Data-culture

Language

Data-culture

Language

AR

Arabic

LT

Lithuanian

BG

Bulgarian

LV

Latvian

CA

Catalan, Valencian

MS

Malay

CS

Czech

NB

Norwegian Bokmål

DA

Danish

NL

Dutch, Flemish

DE

German

PL

Polish

EL

Modern Greek

PT

Portuguese

EN

English

RO

Romanian

ES

Spanish, Castilian

RU

Russian

ET

Estonian

SK

Slovak

FI

Finnish

SL

Slovene

FR

French

SQ

Albanian

HE

Modern Hebrew

SR

Serbian

HI

Hindi

SV

Swedish

HR

Croatian

TH

Thai

HU

Hungarian

TR

Turkish

ID

Indonesian

TW

Taiwanese

IS

Icelandic

UK

Ukrainian

IT

Italian

VI

Vietnamese

JA

Japanese

ZH

Chinese

KO

Korean

Implement with WordPress

For easy integration, download our WordPress Plugin here

  1. The plugin will automatically detect the language of your site, but it only works with one language. See more on multiple languages using WPML below.

  2. The plugin will automatically find and block Youtube, but the rest has to be blocked using our Cookie Control SDK as per usual. See more on that here

  3. ONLY enable TFC if you are also utilizing the TFC template in the pop-up section of the Consent solution. If you are NOT using the TFC template this will render the pop-up useless.

  • Open the dashboard on your WordPress website.

  • Go to Appearance - Editor in the left-hand menu.

Picture1.png
  • Locate header.php. This can have various names depending on the template but will always be explained as (header.php) underneath.

  • This is the HTML of your <head> on all your pages. The Consent Pop-up must be implemented here to be shown on all the pages.

  • Insert the CookieConsent script between the opening and closing <head> tag.

<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="EN" type="text/javascript"></script>

Example:

Picture3.png

A multi-language site using WPML

If you are using the plugin: WPML to change the language on your website, you need to grab the lang-code from the plugin to combine it without data-culture in the consent pop-up script. The script will then look like this:

<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="<?php echo ICL_LANGUAGE_CODE; ?>" type="text/javascript"></script>

Implement with Shopify

Before adding the script itself, you'll need to head into your Online Store Preferences and make sure that "Limit tracking for customers in Europe" is enabled. If your customers are US based, you can also enable "Limit the third-party sale of your California customers' data".

Using the menu on the left-hand side: click on the "Online Store" item, and choose "Online Store" --> "Preferences" --> Scroll down to the "Customer privacy" section

Scroll down to the bottom of the page and click Save.

In order to have the Consent Pop-up display when a visitor comes to your store, you will need to do two things:

  • Create a new file to add the code to

  • Call the file so that it is included in the <head> of your site

Using the menu on the left-hand side again, click on "Online Store" --> "Themes" --> "Current theme" section --> Click "Customize"

At the bottom of the side panel, click "Theme actions" and select "Edit code". A new tab will open where you can make changes to the code of your current theme.

Scroll down the left-hand file explorer until you see a heading called "Snippets". Click "Add a new snippet" and enter "cookie-information-consent" (without quotation marks) as the name of the file. Find the file you just created and click on it (it will be blank).

Paste the following code snippet into the file, remembering to change the data-culture attribute to the correct language code for your site:

{% comment %} Adding CookieInformation script {% endcomment %}

<script>

var cookie_script = document.createElement('script');

cookie_script.setAttribute('src','https://policy.app.cookieinformation.com/uc.js');

cookie_script.setAttribute('data-culture', 'EN');

cookie_script.id = 'CookieConsent';

document.head.appendChild(cookie_script);

{%comment %} CookieInformation Consent event {% endcomment %}

window.addEventListener('CookieInformationConsentGiven', function (event) { if (CookieInformation.getConsentGivenFor('cookie_cat_statistic') && CookieInformation.getConsentGivenFor('cookie_cat_marketing')) {

window.Shopify.customerPrivacy.setTrackingConsent(true, function(e){

console.log("Set Tracking Consent", true);

});

}else{

window.Shopify.customerPrivacy.setTrackingConsent(false, function(e){

console.log("Set Tracking Consent", false);

});

}

}, false);

</script>

Your cookie-information-consent.liquid snippet should now look like this:

Click save.

In the file structure on the left-hand side, scroll up to the top and click on the file called "theme.liquid" under the "Layout" heading. Scroll down until you see the closing </head> tag, and insert the following line of code:

{% render 'cookie-information-consent' %}

Click save.

Implement With Joomla

For easy integration, download our Joomla Plugin here

By using our Joomla plugin you also get an easier way to implement the other privacy widgets. Plus auto-blocking youtube videos and external js scripts.

  • Login to your Joomla administration panel and navigate to the template section in the top menu.

  • Go to Extension - Templates - Templates

001.jpg
  • Choose the active template where you want to insert the consent pop-up.

  • Choose the index.php file from the side-navigation and insert the script just below the meta-tags and before the closing </head> tag as shown below.

<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="EN" type="text/javascript"></script>

Remember to set the data-culture to the language of the consent solution

  • Save the change by pressing “Save & Close” at the top of the page.

002.jpg

Implement with Wix

  1. Go to Settings - Tracking Tool & Analytics

  2. Choose: Custom </>

  3. Then insert the Consent Pop-up script in the code-field and set the code to be placed in the HEAD.

<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="EN" type="text/javascript"></script>

Implement with Squarespace

Go to Settings - Advanced - Code injection

squarespace-menu.jpg

Place the script in the text area for the HEAD section like illustrated below:

<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="EN" type="text/javascript"></script>
mceclip1.png


Did this answer your question?