Site logo

Archived topic

Fire CookiePro script frst

7 replies · Started by Arved on February 1, 2022

Viewing posts 1–8 of 8

Hello,

for GDPR compliance I am trying to implement CookiePro with my website (https://arvedgintenreiter.com). But I struggle to force the autoblock.js script to fire first.

My attempt: Create a hook with the CookiePro banner code and place it in Hook -> wp_head. Unfortunately, with both priority 1 and priority 10 still other scripts run first when loading the site. I seem to miss something.

What would I have to do to run the CookiePro script very first, so it can block content according to the users preferences before that content loads?

<script type="text/javascript" src="https://cookie-cdn.cookiepro.com/consent/.........etc.......OtAutoBlock.js" ></script>

Thanks,
Arved

Hi there,

you can try setting the Priority to 0 that should hook it in immediately before the <title> tag.
But thats not to say there isn't other scripts being enqueued in advance of that or being proxy inserted.

Give zero a try

Hi David,

Thanks for your help! Setting priority 0 helped to gett the script started pretty early, indeed. But there are still two other scripts fired before. Any chance we can make sure that CookiePro is the very first?

Thanks,
Arved

I am not sure how those other scripts being loaded ? Are they from a plugin or a 3rd party source?
As the only way they can be above your hooked script is if they are being enqueued earlier or loaded by proxy

They are from plugins, I guess. Not sure how I could check where they come from. But one is mailchimp and the other is Matomo/Piwik analytics.

Might be worth checking with the plugin authors if you can unhook and rehook those scripts. Then you can set them to a later priority ... they may even have a filter in their code that can do that.

Thank you David, for pointing me where to possibly search :)

Best,
Arved

You're welcome

This archived topic is closed to new replies.