Title: script, control, header/footer?
Last modified: June 27, 2022

---

# script, control, header/footer?

 *  Resolved [aggk](https://wordpress.org/support/users/aggk/)
 * (@aggk)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/script-control-header-footer/)
 * Hi again,
 * Sorry for all the questions but there was one more thing I was wondering.
    When
   creating a new Service that adds a script (google analytics for example). Is 
   there anywhere I can control where this script is added? …some scripts needs 
   to be added early in the head while other scripts should be included in the footer
 * Thanks!

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

 *  Thread Starter [aggk](https://wordpress.org/support/users/aggk/)
 * (@aggk)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/script-control-header-footer/#post-15774186)
 * I think I understand how to control this now by using content blocker instead?
   
   Works great!
 * Thanks!
 *  Plugin Contributor [Matthias Günter](https://wordpress.org/support/users/mguenter/)
 * (@mguenter)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/script-control-header-footer/#post-15774396)
 * Hi [@aggk](https://wordpress.org/support/users/aggk/) !
 * Thanks for your message.
 * Since the scripts are executed asynchronously through JavaScript (not HTML!),
   as they are first checked for consent, it does not matter whether they are in
   the head area or the footer/body area.
 * For Google Analytics in particular, it does not matter at what time this is loaded(
   as soon as you use a cookie banner, this is at the earliest at the time of “interactive”;
   [https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState](https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState)).
 *  Thread Starter [aggk](https://wordpress.org/support/users/aggk/)
 * (@aggk)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/script-control-header-footer/#post-15780126)
 * Thank you for explaining!
 * So what is the preferred way?
    I have one analytics script that I normally place
   in the head. and another script that includes a chatservice which I place in 
   the footer. From what I understand I can control these either by placing the 
   scripts under different “Services” > “My service” > “Code executed on opt-in”…
   or by using “Content blockers” that defines which URL/Elements to block ?
 * Thanks!
 *  Plugin Contributor [Matthias Günter](https://wordpress.org/support/users/mguenter/)
 * (@mguenter)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/script-control-header-footer/#post-15780279)
 * Hi again!
 * Yeah, you can go two ways:
 * Preferred way: Remove your scripts from your head, and use the “Code executed
   on opt-in” field to only run the code if the user has given consent to that service.
   You do not need a Content Blocker for this.
 * The other way: Keep the scripts in your head and block them with a content blocker.
 * Regards,
    Matthew 🙂

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

The topic ‘script, control, header/footer?’ is closed to new replies.

 * ![](https://ps.w.org/real-cookie-banner/assets/icon-256x256.png?rev=2419813)
 * [Real Cookie Banner: GDPR & ePrivacy Cookie Consent](https://wordpress.org/plugins/real-cookie-banner/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/real-cookie-banner/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/real-cookie-banner/)
 * [Active Topics](https://wordpress.org/support/plugin/real-cookie-banner/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/real-cookie-banner/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/real-cookie-banner/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Matthias Günter](https://wordpress.org/support/users/mguenter/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/script-control-header-footer/#post-15780279)
 * Status: resolved