Title: CookieYes script integration with Elementor Custom Code
Last modified: July 4, 2024

---

# CookieYes script integration with Elementor Custom Code

 *  Resolved [Vitaio](https://wordpress.org/support/users/vitaio/)
 * (@vitaio)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/cookieyes-script-integration-with-elementor-custom-code/)
 * Dear Customer Support,
 * Is it possible to implement the following code on the site without placing it
   in the header.php file or using an external plugin? I primarily use Elementor
   to build the site, but when I insert the code below with priority 1 under the
   Elementor – Custom Code menu, several other codes (such as the Google Analytics
   code from the Site Kit plugin) run before it. As far as I understand, the code
   below needs to run first. Can you help me solve this issue?
 *     ```wp-block-code
       <script>    window.dataLayer = window.dataLayer || [];    function gtag() {        dataLayer.push(arguments);    }    gtag("consent", "default", {        ad_storage: "denied",        ad_user_data: "denied",        ad_personalization: "denied",        analytics_storage: "denied",        functionality_storage: "denied",        personalization_storage: "denied",        security_storage: "granted",        wait_for_update: 2000,    });    gtag("set", "ads_data_redaction", true);    gtag("set", "url_passthrough", true);        </script>
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcookieyes-script-integration-with-elementor-custom-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/cookieyes-script-integration-with-elementor-custom-code/#post-17878821)
 * Hi [@vitaio](https://wordpress.org/support/users/vitaio/),
 * Greetings from CookieYes!
 * Please try the code snippet below by copying it to your site’s active child themes
   functions.php file.
 *     ```wp-block-code
       add_action('wp_head', 'cky_add_script_to_head', -1);function cky_add_script_to_head() {    ?><script>    window.dataLayer = window.dataLayer || [];    function gtag() {        dataLayer.push(arguments);    }    gtag("consent", "default", {        ad_storage: "denied",        ad_user_data: "denied",         ad_personalization: "denied",        analytics_storage: "denied",        functionality_storage: "denied",        personalization_storage: "denied",        security_storage: "granted",        wait_for_update: 2000,    });    gtag("set", "ads_data_redaction", true);    gtag("set", "url_passthrough", true);</script>    <?php}
       ```
   
 *  Thread Starter [Vitaio](https://wordpress.org/support/users/vitaio/)
 * (@vitaio)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/cookieyes-script-integration-with-elementor-custom-code/#post-17882585)
 * Thanks for your help, it works fine.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘CookieYes script integration with Elementor Custom Code’ is closed to
new replies.

 * ![](https://ps.w.org/cookie-law-info/assets/icon.svg?rev=3007243)
 * [CookieYes – Cookie Banner for Cookie Consent (Easy to setup GDPR/CCPA Compliant Cookie Notice)](https://wordpress.org/plugins/cookie-law-info/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-law-info/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-law-info/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-law-info/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-law-info/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-law-info/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Vitaio](https://wordpress.org/support/users/vitaio/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/cookieyes-script-integration-with-elementor-custom-code/#post-17882585)
 * Status: resolved