• Resolved aggk

    (@aggk)


    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

    (@aggk)

    I think I understand how to control this now by using content blocker instead?
    Works great!

    Thanks!

    Plugin Contributor Matthias Günter

    (@mguenter)

    Hi @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).

    Thread Starter aggk

    (@aggk)

    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

    (@mguenter)

    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.