Title: Add Google Consent Mode Script
Last modified: December 9, 2023

---

# Add Google Consent Mode Script

 *  Resolved [ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/)
 * (@ricardomdsilva)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/)
 * Hi, 
   I’m trying to implement Google Consent Mode using this [tutorial](https://www.cookieyes.com/documentation/implementing-google-consent-mode-using-cookieyes/)
   and I would apreciate some help. I’m more familiar with Google Tag Manager but,
   as I’m using the Plugin version, I understand that it won’t work. So I tried 
   the second method, which consists in adding a script to the header of my site.
   As I’m not familiar with coding, I installed the [WPCode ](https://wordpress.org/plugins/insert-headers-and-footers/)
   plugin to insert the script as a snippet. I understand that the script placement
   shoud have priority over the GTM and the CookieYes scripts, but this plugin (
   or any other similar plugins I found) doesn’t allow me to edit the header file
   itself – only add a new script (which I assume is randomly placed). However, 
   it allows me to set a priority level to a script, so I put in in max priority.
   Dit it work? Can you please help me confirm or give any suggestions if not. Thank
   you.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadd-google-consent-mode-script%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17271468)
 * Hi [@ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/),
 * Greetings from CookieYes!
 * You can add scripts to your site via the active theme’s header.php file.
 * While using the plugin, we append the CookieYes script via the `wp_head()` function.
   So you can add the other scripts above the `wp_head()` in your header.php file
   to maintain the order of the scripts.
 * Also we found that GoogleAds is not blocked prior to consent on your site. Seems
   like those cookies are missing in your cookie list as well. So please run a scan
   or add them manually to the cookie list.
 *  Thread Starter [ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/)
 * (@ricardomdsilva)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17284065)
 * Hi. I added the script via header.php. Can you please confirm if everything is
   ok?
   I also ran another scan, which added cookies for doubleclick.net, that I 
   believe is the GoogleAdsense Marketing platform.
 * Thanks.
 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17284669)
 * Hi [@ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/),
 * Please place the GTM script also above the CookieYes script. Also we found that
   some ad scripts are not blocked prior to consent. So please add `googlesyndication.
   com/pagead` to the script URL patterns of Advertisement cookie.
 *  Thread Starter [ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/)
 * (@ricardomdsilva)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17287287)
 * Hi [@cookieyesteam](https://wordpress.org/support/users/cookieyesteam/),
 * I added your code just the way you told me in the header.php file, but I believe
   the other scripts are not there – maybe that’s why this solution is not working.
   
   Can’t you work on a solution via Google Tag Manager for the plugin users?
 * Thanks.
 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17291528)
 * Hi [@ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/),
 * As we have mentioned earlier, please add  `googlesyndication.com/pagead` to the
   script URL patterns of Advertisement cookie and this will be blocked automatically.
 * While implementing CookieYes via GTM template, you need not use the plugin as
   this will add duplicate scripts to your site.
 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17301188)
 * Hi [@ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/),
 * This thread has been inactive for a bit, so we are going to mark it as resolved
   now. Please feel free to open a new thread or follow-up if you have any further
   questions or still need help.
 *  [manevilhena](https://wordpress.org/support/users/himidia/)
 * (@himidia)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17458115)
 * Hi I am having the same problem as [@ricardomdsilva](https://wordpress.org/support/users/ricardomdsilva/).
 * When I added the CookieYes GA Consent Mode Script to my header using WPCode Plugin,
   it is not possible to determine the position of the script above the GTM script.
 * Also the GTM Script was added using the GTM plugin, so I cannot determine the
   position of the GTM Script in the header too.
 * So I have the plugin and app active, but cannot find a way to set those scripts
   in the correct order, since they are all fired directly from the plugins (GTM,
   CookieYes)
 * I tried to just hardcode the CookieYes GA Consent Mode Script in my header, but
   i don’t think it will work, since there are no other scripts there.
 * Can you guys help me? My website is: [https://barcelonatours.net/](https://barcelonatours.net/)

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

The topic ‘Add Google Consent Mode Script’ 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/)

## Tags

 * [gtm](https://wordpress.org/support/topic-tag/gtm/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [script](https://wordpress.org/support/topic-tag/script/)

 * 7 replies
 * 3 participants
 * Last reply from: [manevilhena](https://wordpress.org/support/users/himidia/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/add-google-consent-mode-script/#post-17458115)
 * Status: resolved