Skip Navigation

[Resolved] Installing GDPS compliant Banner

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted know how to add a script to the header of their website.

Solution:

This is possible to do with Toolset, however you will need to wrap the script tag in one of the WordPress hooks that allow you to insert the script into the header.

You can use the hook below.

function wpb_hook_javascript() {
    ?>
       <!-- Start cookieyes banner --> <script id="cookieyes" type="text/javascript" src="https://cdn-cookieyes.com/client_data/fcec4432640d070c50f260b1/script.js"></script> <!-- End cookieyes banner -->
    <?php
}
add_action('wp_head', 'wpb_hook_javascript');

This can be added to the Toolset Custom code settings in Toolset -> Settings -> Custom Code, ensure that it is activated once you've set it up. If you want to have the code run only on the frontend then you will need to check only the frontend option.

Alternatively you can use the plugin below to add the script as well.
https://wordpress.org/plugins/insert-headers-and-footers/

This support ticket is created 3 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by ilonaB-2 3 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#2216699

Hello,

Currently trying to install a GDPR Compliant Banner for cookie notice.

For this they provided me with a code, but i have no idea where to put it. Their advise was to implement it in the Theme settings, but also mentioned when the Theme gets an update this code gets overritten.

This is the code:
<!-- Start cookieyes banner --> <script id="cookieyes" type="text/javascript" src="hidden link"></script> <!-- End cookieyes banner -->

Is this something i can implement somewhere in the Toolset settings and if so where is the best option?

Thanks in advance for your feedback.

Regards

#2216775

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ilona,

Thank you for getting in touch.

This is possible to do with Toolset, however you will need to wrap the script tag in one of the WordPress hooks that allow you to insert the script into the header.

You can use the hook below.

function wpb_hook_javascript() {
    ?>
       <!-- Start cookieyes banner --> <script id="cookieyes" type="text/javascript" src="<em><u>hidden link</u></em>"></script> <!-- End cookieyes banner -->
    <?php
}
add_action('wp_head', 'wpb_hook_javascript');

This can be added to the Toolset Custom code settings in Toolset -> Settings -> Custom Code, ensure that it is activated once you've set it up. If you want to have the code run only on the frontend then you will need to check only the frontend option.

Alternatively you can use the plugin below to add the script as well.
https://wordpress.org/plugins/insert-headers-and-footers/

Please let me know if this helps.
Thanks,
Shane

#2216833

Hi Shane,

Thanks so much, the plugin worked perfect.

My issue is resolved now. Thank you!